제출 #1176946

#제출 시각아이디문제언어결과실행 시간메모리
1176946theagentbaraLjeto (COCI21_ljeto)C++20
50 / 50
0 ms328 KiB
#include "bits/stdc++.h" using namespace std; #define int long long #define endl '\n' #define all(v) v.begin(), v.end() const long long sz = 2e5 + 5; const long long inf = 1e18; const long long mod = 1e9 + 9; int t[sz], a[sz], b[sz]; void solve() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> t[i] >> a[i] >> b[i]; } set< pair<int, int> > ta, tb; int cntp = 0, cntb = 0; for (int i = 1; i <= n; i++) { if (a[i] >= 1 and a[i] <= 4) { cntp += 100; if (ta.empty()) { ta.insert({t[i], a[i]}); continue; } int s = -1, g = -1; for (auto x : ta) { if (x.second == a[i]) { s = x.first, g = a[i]; } } if (g != -1 and t[i] - s <= 10) { cntp += 50; } ta.erase({s, g}); ta.insert({t[i], a[i]}); } else { cntb += 100; if (tb.empty()) { tb.insert({t[i], a[i]}); continue; } int s = -1, g = -1; for (auto x : tb) { if (x.second == a[i]) { s = x.first, g = a[i]; } } if (g != -1 and t[i] - s <= 10) { cntb += 50; } tb.erase({s, g}); tb.insert({t[i], a[i]}); } // cout << cntp << " " << cntb << endl; } cout << cntp << " " << cntb << endl; } signed main() { cin.tie(nullptr)->sync_with_stdio(0); int T = 1; // cin >> T; while (T--) { solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...