# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
611465 |
2022-07-29T05:11:19 Z |
이동현(#8500) |
Segway (COI19_segway) |
C++17 |
|
195 ms |
34644 KB |
#include <bits/stdc++.h>
using namespace std;
const int NS = (int)2e4 + 4;
int n, m;
int a[NS][3];
int t[NS], pos[NS], ex[304], fast[NS];
vector<int> que[300 * 300 + 4];
int tr[304];
void push(int x, int val){++x;for(int i = x; i < 304; i += (i & -i)){tr[i] += val;}}
int get(int x){++x;int rv = 0; for(int i = x; i > 0; i -= (i & -i)){rv += tr[i];} return rv;}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for(int i = 0; i < n; ++i){
for(int j = 0; j < 3; ++j){
cin >> a[i][j];
}
que[a[i][0]].push_back(i);
push(0, 1);
}
cin >> m;
for(int i = 0; i < m; ++i){
int x; cin >> x;
ex[x] = 1;
}
for(int i = 0; i < 300 * 300 + 4; ++i){
for(int j = 0; j < (int)que[i].size(); ++j){
int id = que[i][j];
if(pos[id] + 1 < 300 && !fast[id] && ex[pos[id]]){
fast[id] = (get(300) - get(pos[id])) % 20;
}
}
for(int j = 0; j < (int)que[i].size(); ++j){
int id = que[i][j];
if(pos[id] == 300) continue;
push(pos[id], -1), push(pos[id] + 1, 1);
if(fast[id]) t[id] += 1, --fast[id];
else{
if(pos[id] < 100) t[id] += a[id][0];
else if(pos[id] < 200) t[id] += a[id][1];
else t[id] += a[id][2];
}
++pos[id];
que[t[id]].push_back(id);
}
}
for(int i = 0; i < n; ++i){
cout << t[i] << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2388 KB |
Output is correct |
2 |
Correct |
7 ms |
2832 KB |
Output is correct |
3 |
Correct |
12 ms |
3924 KB |
Output is correct |
4 |
Correct |
35 ms |
7700 KB |
Output is correct |
5 |
Correct |
195 ms |
34644 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2388 KB |
Output is correct |
2 |
Correct |
3 ms |
2448 KB |
Output is correct |
3 |
Incorrect |
2 ms |
2388 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2388 KB |
Output is correct |
2 |
Correct |
7 ms |
2832 KB |
Output is correct |
3 |
Correct |
12 ms |
3924 KB |
Output is correct |
4 |
Correct |
35 ms |
7700 KB |
Output is correct |
5 |
Correct |
195 ms |
34644 KB |
Output is correct |
6 |
Correct |
2 ms |
2388 KB |
Output is correct |
7 |
Correct |
3 ms |
2448 KB |
Output is correct |
8 |
Incorrect |
2 ms |
2388 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |