# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1123862 | serifefedartar | Naval battle (CEOI24_battle) | C++20 | 0 ms | 0 KiB |
{
fast;
int N;
cin >> N;
for (int i = 1; i <= N; i++) {
int x, y; char ch;
cin >> x >> y >> ch;
if (ch == 'E')
E.push_back({{x, y}, i});
else
S.push_back({{x, y}, i});
}
for (auto u : E)
mp[u.f.f + u.f.s].push_back({u.f, {'E', u.s}});
for (auto u : S)
mp[u.f.f + u.f.s].push_back({u.f, {'S', u.s}});
for (auto u : mp) {
sort(mp[u.f].begin(), mp[u.f].end());
queue<int> q;
for (auto u : mp[u.f]) {
if (u.s.f == 'E')
q.push(u.s.s);
else if (q.size())
q.pop();
else
cout << u.s.s << "\n";
}
while (!q.empty()) {
cout << q.front() << "\n";
q.pop();
}
}
}