Submission #1123809

#TimeUsernameProblemLanguageResultExecution timeMemory
1123809serifefedartarNaval battle (CEOI24_battle)C++20
0 / 100
228 ms26020 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0) typedef long long ll; #define f first #define s second #define LOGN 21 const ll MOD = 1e9 + 7; const ll MAXN = 1e5 + 100; vector< pair<pair<int,int>,int> > S, E; map< int, vector<pair<pair<int,int>, pair<char,int>>> > mp; int main() { 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(); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...