제출 #1176893

#제출 시각아이디문제언어결과실행 시간메모리
1176893theagentbaraLjeto (COCI21_ljeto)C++20
25 / 50
1 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; } pair<int, int> p = *ta.begin(); int s = p.first, g = p.second; if (g == a[i] and t[i] - s <= 10) cntp += 50; ta.erase(ta.begin()); ta.insert({t[i], a[i]}); } else { cntb += 100; if (tb.empty()) { tb.insert({t[i], a[i]}); continue; } pair<int, int> p = *tb.begin(); int s = p.first, g = p.second; if (g == a[i] and t[i] - s <= 10) cntb += 50; tb.erase(tb.begin()); tb.insert({t[i], a[i]}); } } 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...