# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
273120 | 2020-08-19T04:13:44 Z | 반딧불(#5107) | A Game with Grundy (CCO20_day1problem1) | C++17 | 77 ms | 7060 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; ll l, r, y; vector<pair<ll, ll> > vec; ll ans[100002]; int main(){ scanf("%d %lld %lld %lld", &n, &l, &r, &y); vec.push_back({l, 0}), vec.push_back({r+1, 0}); for(int i=1; i<=n; i++){ ll x, v, h; scanf("%lld %lld %lld", &x, &v, &h); ll tmp = (h * y - 1) / v; vec.push_back({x-tmp, 1}); vec.push_back({x+tmp+1, -1}); } sort(vec.begin(), vec.end()); ll prv = INT_MIN; ll depth = 0; for(int i=0; i<(int)vec.size(); i++){ if(l < vec[i].first && vec[i].first <= r+1) ans[depth] += vec[i].first - prv; prv = vec[i].first; depth += vec[i].second; } for(int i=0; i<=n; i++){ printf("%lld\n", ans[i]); ans[i+1] += ans[i]; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 70 ms | 6364 KB | Output is correct |
4 | Correct | 68 ms | 6364 KB | Output is correct |
5 | Correct | 75 ms | 6460 KB | Output is correct |
6 | Correct | 66 ms | 5852 KB | Output is correct |
7 | Correct | 64 ms | 5968 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 70 ms | 6364 KB | Output is correct |
4 | Correct | 68 ms | 6364 KB | Output is correct |
5 | Correct | 75 ms | 6460 KB | Output is correct |
6 | Correct | 66 ms | 5852 KB | Output is correct |
7 | Correct | 64 ms | 5968 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 74 ms | 7004 KB | Output is correct |
10 | Correct | 72 ms | 7060 KB | Output is correct |
11 | Correct | 71 ms | 7004 KB | Output is correct |
12 | Correct | 77 ms | 6876 KB | Output is correct |
13 | Correct | 56 ms | 6236 KB | Output is correct |