# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
273186 | 2020-08-19T04:24:31 Z | 문홍윤(#5110) | A Game with Grundy (CCO20_day1problem1) | C++17 | 89 ms | 5472 KB |
#include <bits/stdc++.h> #define eb emplace_back #define mp make_pair #define F first #define S second #define all(x) x.begin(), x.end() #define svec(x) sort(x.begin(), x.end()) #define press(x) x.erase(unique(x.begin(), x.end()), x.end()) using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; typedef pair<int, LL> pil; typedef pair<LL, int> pli; const LL llinf=2e18; const int inf=1e9; int n; LL l, r, y, ans[100010]; vector<pli> vc; int main(){ scanf("%d %lld %lld %lld", &n, &l, &r, &y); vc.eb(l, 0); vc.eb(r+1, 0); for(int i=1; i<=n; i++){ LL x, v, h, d; scanf("%lld %lld %lld", &x, &v, &h); d=(h*y-1)/v; LL s=max(x-d, l), e=min(x+d+1, r+1); vc.eb(s, 1); vc.eb(e, -1); } svec(vc); LL prv=l; int d=0; for(auto i:vc){ ans[d]+=i.F-prv; prv=i.F; d+=i.S; } for(int i=0; i<=n; i++){ printf("%lld\n", ans[i]); ans[i+1]+=ans[i]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 85 ms | 5148 KB | Output is correct |
4 | Correct | 89 ms | 5084 KB | Output is correct |
5 | Correct | 72 ms | 5084 KB | Output is correct |
6 | Correct | 83 ms | 4584 KB | Output is correct |
7 | Correct | 57 ms | 5212 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 85 ms | 5148 KB | Output is correct |
4 | Correct | 89 ms | 5084 KB | Output is correct |
5 | Correct | 72 ms | 5084 KB | Output is correct |
6 | Correct | 83 ms | 4584 KB | Output is correct |
7 | Correct | 57 ms | 5212 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 80 ms | 5340 KB | Output is correct |
10 | Correct | 74 ms | 5472 KB | Output is correct |
11 | Correct | 73 ms | 5340 KB | Output is correct |
12 | Correct | 77 ms | 5340 KB | Output is correct |
13 | Correct | 63 ms | 5468 KB | Output is correct |