-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
FORTRESS self review 
1. ํด๊ฒฐ ์๋ ๊ณผ์
์คํฐ๋ ์๋ฃ๋ฅผ ๋ณด๊ณ ์ฑ๋ฒฝ ์์น์ ๋ฐ์ง๋ฆ์ ๋ด์ ๊ตฌ์กฐ์ฒด๋ฅผ ๋ง๋ค์์ต๋๋ค.
๊ทธ ๋ค์ ํฌํจ๊ด๊ณ๋ฅผ ์ฝ๊ฒ ๊ตฌํ๊ธฐ ์ํด ๋ฐ์ง๋ฆ์ ๊ธฐ์ค์ผ๋ก ๋ด๋ฆผ์ฐจ์ ์ ๋ ฌ์ ํ์์ต๋๋ค.
2. ์์ฑํ ์ฝ๋์ ์ค๋ช
struct Rampart {
int x, y, r;
Rampart(int x, int y, int r) {
this->x = x;
this->y = y;
this->r = r;
}
bool operator> (const Rampart &a)const {
return r > a.r;
}
};์ฑ๋ฒฝ์ ์์น์ ๋ฐ์ง๋ฆ ์ ๋ณด๋ฅผ ๋ด์ ๊ตฌ์กฐ์ฒด์ ๋๋ค. ์ ๋ ฌ์ ๋ฐ์ง๋ฆ์ ๊ธฐ์ค์ผ๋ก ๋ด๋ฆผ์ฐจ์ ์ ๋ ฌ์ ํด ์ฃผ์์ต๋๋ค.
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int c;
cin >> c;
while (c--) {
int n, a, b, c;
cin >> n;
vector <Rampart> v;
for (int i = 0; i < n; i++) {
cin >> a >> b >> c;
v.push_back(Rampart(a,b,c));
}
sort(v.begin(), v.end());
}
}vector์ ์๋ฃํ์ Rampart๋ก ํด์ ์์ฑํด์ฃผ๊ณ ์ ๋ ฌ์ ํด ์ฃผ์์ต๋๋ค.
3. ๋งํ ์ ๋ฐ ๊ฐ์ ์ฌํญ
์ ๋ ฌ์ ํ๋๋ฐ ๊ทธ ์ ๋ณด๋ก ํธ๋ฆฌ๋ฅผ ๊ตฌํํ๋ ๊ณผ์ ์์ ๋งํ์ต๋๋ค. ์ด ๋ถ๋ถ์ ์ข ๋ ๊ณ ๋ฏผํด ๋ด์ผํ ๊ฒ ๊ฐ์ต๋๋ค.