# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
243502 | 2020-07-01T09:13:46 Z | vanic | Segway (COI19_segway) | C++14 | 279 ms | 32760 KB |
#include <cstdio> #include <math.h> #include <algorithm> #include <vector> #include <queue> #include <bitset> using namespace std; const int maxn=2e4+5, maxp=305; int v[maxn][3]; vector < int > q[50*maxp]; int loc[maxn]; int sad[maxp]; int acel[maxn]; bitset < maxp > boost; int sol[maxn]; vector < int > ind; int pref[maxp]; int main(){ int n; scanf("%d", &n); for(int i=0; i<n; i++){ scanf("%d%d%d", &v[i][0], &v[i][1], &v[i][2]); q[v[i][0]].push_back(i); } int m; scanf("%d", &m); int a; for(int i=0; i<m; i++){ scanf("%d", &a); boost[a]=1; } for(int i=0; i<maxp; i++){ pref[i]=n; } int p; for(int i=0; i<50*maxp; i++){ while(!q[i].empty()){ p=q[i].back(); q[i].pop_back(); ind.push_back(p); pref[loc[p]]--; loc[p]++; sad[loc[p]]++; if(loc[p]==300){ sol[p]=i; continue; } if(!acel[p] && boost[loc[p]]){ acel[p]=(n-pref[loc[p]-1]-sad[loc[p]])%20; } if(acel[p]){ acel[p]--; q[i+1].push_back(p); } else{ q[i+v[p][loc[p]/100]].push_back(p); } } while(!ind.empty()){ sad[loc[ind.back()]]--; ind.pop_back(); } } for(int i=0; i<n; i++){ printf("%d\n", sol[i]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 768 KB | Output is correct |
2 | Correct | 8 ms | 1152 KB | Output is correct |
3 | Correct | 16 ms | 2176 KB | Output is correct |
4 | Correct | 42 ms | 5880 KB | Output is correct |
5 | Correct | 279 ms | 32760 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 768 KB | Output is correct |
2 | Correct | 5 ms | 768 KB | Output is correct |
3 | Correct | 5 ms | 768 KB | Output is correct |
4 | Correct | 5 ms | 640 KB | Output is correct |
5 | Correct | 5 ms | 768 KB | Output is correct |
6 | Correct | 6 ms | 768 KB | Output is correct |
7 | Correct | 7 ms | 896 KB | Output is correct |
8 | Correct | 7 ms | 1024 KB | Output is correct |
9 | Correct | 8 ms | 1152 KB | Output is correct |
10 | Correct | 9 ms | 1280 KB | Output is correct |
11 | Correct | 7 ms | 1152 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 768 KB | Output is correct |
2 | Correct | 8 ms | 1152 KB | Output is correct |
3 | Correct | 16 ms | 2176 KB | Output is correct |
4 | Correct | 42 ms | 5880 KB | Output is correct |
5 | Correct | 279 ms | 32760 KB | Output is correct |
6 | Correct | 5 ms | 768 KB | Output is correct |
7 | Correct | 5 ms | 768 KB | Output is correct |
8 | Correct | 5 ms | 768 KB | Output is correct |
9 | Correct | 5 ms | 640 KB | Output is correct |
10 | Correct | 5 ms | 768 KB | Output is correct |
11 | Correct | 6 ms | 768 KB | Output is correct |
12 | Correct | 7 ms | 896 KB | Output is correct |
13 | Correct | 7 ms | 1024 KB | Output is correct |
14 | Correct | 8 ms | 1152 KB | Output is correct |
15 | Correct | 9 ms | 1280 KB | Output is correct |
16 | Correct | 7 ms | 1152 KB | Output is correct |
17 | Correct | 18 ms | 2560 KB | Output is correct |
18 | Correct | 23 ms | 4156 KB | Output is correct |
19 | Correct | 92 ms | 14968 KB | Output is correct |
20 | Correct | 135 ms | 19748 KB | Output is correct |
21 | Correct | 153 ms | 23288 KB | Output is correct |
22 | Correct | 193 ms | 28152 KB | Output is correct |
23 | Correct | 174 ms | 26308 KB | Output is correct |