Submission #577118

#TimeUsernameProblemLanguageResultExecution timeMemory
577118eecsA Game with Grundy (CCO20_day1problem1)C++17
25 / 25
120 ms12752 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, L, R, Y; cin >> n >> L >> R >> Y; map<int, int> mp; for (int i = 0, x, v, h; i < n; i++) { cin >> x >> v >> h; int l = max(1LL * L, x - (1LL * h * Y - 1) / v); int r = min(1LL * R, x + (1LL * h * Y - 1) / v); mp[l]++, mp[r + 1]--; } vector<int> res(n + 1); int lst = L, cur = 0; for (auto &p : mp) { res[cur] += p.first - lst; cur += p.second, lst = p.first; } res[cur] += R + 1 - lst; for (int i = 0; i <= n; i++) { if (i) res[i] += res[i - 1]; cout << res[i] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...