Skip to content

[Week 5] FORTRESS self review - Yunhyunjoย #176

@Yunhyunjo

Description

@Yunhyunjo

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. ๋ง‰ํžŒ ์  ๋ฐ ๊ฐœ์„  ์‚ฌํ•ญ

์ •๋ ฌ์€ ํ–ˆ๋Š”๋ฐ ๊ทธ ์ •๋ณด๋กœ ํŠธ๋ฆฌ๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋ง‰ํ˜”์Šต๋‹ˆ๋‹ค. ์ด ๋ถ€๋ถ„์„ ์ข€ ๋” ๊ณ ๋ฏผํ•ด ๋ด์•ผํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2๊ธฐ์Šคํ„ฐ๋”” 2๊ธฐWAWrong Answer

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions