Submission #1134672

#TimeUsernameProblemLanguageResultExecution timeMemory
1134672saidponNaval battle (CEOI24_battle)C++17
30 / 100
411 ms39248 KiB
#include <bits/stdc++.h> #define nemeshay ios_base::sync_with_stdio(NULL), cin.tie(0), cout.tie(0); #define int long long #define sigma signed #define pb push_back #define pii pair<int, int> #define fr first #define sc second using namespace std; const int N = 2e5 + 2, inf = 1e18 + 7; pair<pii, pair<char, int>> a[N]; sigma main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].fr.fr >> a[i].fr.sc >> a[i].sc.fr; a[i].sc.sc = i; } set <int> ans; sort(a + 1, a + n + 1); map <int, vector<int>> pon; for (int i = 1; i <= n; i++) ans.insert(i), pon[a[i].fr.fr + a[i].fr.sc].pb(i); for (auto j: pon) { vector <int> ok; for (auto i: j.sc) { if (ok.size() && a[i].sc.fr == 'S' && a[ok.back()].sc.fr == 'E') ans.erase(a[ok.back()].sc.sc), ans.erase(a[i].sc.sc), ok.pop_back(); else ok.pb(i); } } for (auto j: ans) cout << j << endl; }
#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...