# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
117919 | onjo0127 | Segway (COI19_segway) | C++11 | 90 ms | 6520 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int cnt[333];
int a[20009], b[20009], c[20009], l[20009], p[20009], ans[20009];
bool chk[333];
vector<int> ev[55]; int MOD = 55, now = 0;
int main() {
int N; scanf("%d",&N);
for(int i=1; i<=N; i++) {
scanf("%d%d%d", &a[i], &b[i], &c[i]);
ev[a[i]].push_back(i);
}
int M; scanf("%d",&M);
while(M--) {
int foo; scanf("%d", &foo);
chk[foo] = 1;
}
while(cnt[300] < N) {
++now;
for(auto& it: ev[now % MOD]) {
++p[it];
if(chk[p[it]] && !l[it]) l[it] = cnt[p[it]] % 20;
if(p[it] == 300) ans[it] = now;
else if(l[it]) {
--l[it];
ev[(now + 1) % MOD].push_back(it);
}
else {
int nxt;
if(p[it] < 100) nxt = (now + a[it]) % MOD;
else if(p[it] < 200) nxt = (now + b[it]) % MOD;
else nxt = (now + c[it]) % MOD;
ev[nxt].push_back(it);
}
}
for(auto& it: ev[now % MOD]) ++cnt[p[it]];
ev[now % MOD].clear();
}
for(int i=1; i<=N; i++) printf("%d\n", ans[i]);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |