# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1069876 | 2024-08-22T09:35:41 Z | new_acc | 장난감 기차 (IOI17_train) | C++14 | 10 ms | 6300 KB |
#include "train.h" #include<bits/stdc++.h> #define fi first #define se second using namespace std; typedef vector<int> vi; const int N=1e5+10; int t[N],t2[N],n,m,il[N]; vi graf[N],graf2[N]; bool byl[N]; vi who_wins(vi a,vi r,vi u,vi v) { n=a.size(),m=u.size(); vi res(n,1); for(int i=1;i<=n;i++) t[i]=a[i-1],t2[i]=r[i-1]; for(int i=1;i<=m;i++){ graf[u[i-1]+1].push_back(v[i-1]+1); graf2[v[i-1]+1].push_back(u[i-1]+1); } for(int i=1;i<=n;i++) il[i]=graf[i].size(); vi curr; for(int i=1;i<=n;i++){ if(t2[i]) curr.push_back(i),byl[i]=1; } for(int i=0;i<curr.size();i++){ int x=curr[i]; for(auto u:graf2[x]){ if(t[u]){ if(!byl[u]) curr.push_back(u); byl[u]=1; }else{ il[u]--; if(il[u]==0 and !byl[u]){ byl[u]=1; curr.push_back(u); } } } } curr.clear(); for(int i=1;i<=n;i++){ if(!byl[i]){ curr.push_back(i); res[i-1]=0; } il[i]=graf[i].size(); } for(int i=0;i<curr.size();i++){ int x=curr[i]; for(auto u:graf2[x]){ if(!t[u]){ if(res[u-1]){ res[u-1]=0; curr.push_back(u); } }else{ il[u]--; if(il[u]==0 and !res[u-1]){ res[u-1]=0; curr.push_back(u); } } } } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 5724 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 4956 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 5976 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 5720 KB | Output is correct |
2 | Correct | 6 ms | 5980 KB | Output is correct |
3 | Correct | 6 ms | 6232 KB | Output is correct |
4 | Correct | 6 ms | 6236 KB | Output is correct |
5 | Correct | 10 ms | 6216 KB | Output is correct |
6 | Correct | 6 ms | 6232 KB | Output is correct |
7 | Correct | 6 ms | 6236 KB | Output is correct |
8 | Correct | 5 ms | 6236 KB | Output is correct |
9 | Correct | 5 ms | 5964 KB | Output is correct |
10 | Correct | 6 ms | 6236 KB | Output is correct |
11 | Correct | 7 ms | 6236 KB | Output is correct |
12 | Correct | 7 ms | 6236 KB | Output is correct |
13 | Correct | 6 ms | 6236 KB | Output is correct |
14 | Correct | 5 ms | 5980 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5980 KB | Output is correct |
2 | Correct | 6 ms | 6300 KB | Output is correct |
3 | Correct | 7 ms | 6236 KB | Output is correct |
4 | Correct | 9 ms | 6020 KB | Output is correct |
5 | Correct | 2 ms | 5208 KB | Output is correct |
6 | Correct | 4 ms | 5720 KB | Output is correct |
7 | Correct | 7 ms | 5676 KB | Output is correct |
8 | Incorrect | 4 ms | 5724 KB | 3rd lines differ - on the 5th token, expected: '0', found: '1' |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 5724 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |