# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1041456 | 2024-08-02T04:09:16 Z | vjudge1 | Segway (COI19_segway) | C++17 | 24 ms | 1376 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define MOD 1000000007 void solve(){ ll n , m , k , a , mx = 0; cin >> n; int ls[n + 1][4]; for(int i =1 ;i <= n ;i ++){ for(int j = 0; j< 3; j++){ cin >> ls[i][j]; } } vector<ll> pre(15050) , acc(310) , ans(n + 1) , pos(n + 1) , sped(n + 1); cin >> m; for(int i =0 ;i < m ;i ++){ cin >> a; acc[a] = 1; } for(int i = 0 ;i< 300; i ++){ for(int j =0 ; j< 15050; j ++){ pre[j] = 0; } ll mx = 0; for(int j = 1; j <=n ; j++){ pre[ans[j]] += 1; mx = max(mx , ans[j]); } for(int j =1 ; j <= mx; j ++){ pre[j] += pre[j - 1]; } for (int j = 1; j <= n; j++){ if (sped[j] and pos[j] < 300){ pos[j] += 1; ans[j] += 1; sped[j] -= 1; } else if (pos[j] < 300){ ll val = 0; if(ans[j] - 1 >= 0){ val = pre[ans[j] - 1] % 20; } if (acc[i]){ sped[j] = val; } if (sped[j]){ sped[j] -= 1; pos[j] += 1; ans[j] += 1; } else{ ans[j] += ls[j][i / 100]; } } } } for(int i = 1; i<= n ;i ++){ cout << ans[i] << '\n'; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tests = 1; // cin >> tests; for (int i = 1; i <= tests; i++){ solve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 604 KB | Output is correct |
4 | Correct | 4 ms | 632 KB | Output is correct |
5 | Correct | 19 ms | 1372 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 2 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 604 KB | Output is correct |
4 | Correct | 4 ms | 632 KB | Output is correct |
5 | Correct | 19 ms | 1372 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 2 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 2 ms | 604 KB | Output is correct |
18 | Correct | 3 ms | 604 KB | Output is correct |
19 | Correct | 11 ms | 860 KB | Output is correct |
20 | Correct | 14 ms | 860 KB | Output is correct |
21 | Correct | 18 ms | 1168 KB | Output is correct |
22 | Correct | 24 ms | 1376 KB | Output is correct |
23 | Correct | 22 ms | 1372 KB | Output is correct |