# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
427569 | 2021-06-14T17:18:19 Z | TLP39 | 장난감 기차 (IOI17_train) | C++14 | 19 ms | 1100 KB |
#include "train.h" #include<bits/stdc++.h> using namespace std; int n,m; vector<int> point_to[5003]; int ori_outdeg[5003]={}; int temp_outdeg[5003]; bool loop[5003]; bool temp_loop[5003]; int cou_loop=0,cou_temp_loop; bool getreach() { queue<int> q; int tt; for(int i=0;i<n;i++) temp_outdeg[i]=ori_outdeg[i]; for(int i=0;i<n;i++) temp_loop[i]=false; cou_temp_loop=0; for(int j=0;j<n;j++) { if(!loop[j]) continue; for(int i=0;i<point_to[j].size();i++) { temp_outdeg[point_to[j][i]]--; if(!temp_outdeg[point_to[j][i]]) q.push(point_to[j][i]); } } while(!q.empty()) { tt=q.front(); q.pop(); temp_loop[tt]=true; if(loop[tt]) { cou_temp_loop++; continue; } for(int i=0;i<point_to[tt].size();i++) { temp_outdeg[point_to[tt][i]]--; if(!temp_outdeg[point_to[tt][i]]) q.push(point_to[tt][i]); } } for(int i=0;i<n;i++) loop[i]=temp_loop[i]; int temp2=cou_loop; cou_loop=cou_temp_loop; return temp2==cou_temp_loop; } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { std::vector<int> res(a.size(),1); n=a.size(); m=u.size(); for(int i=0;i<m;i++) { point_to[v[i]].push_back(u[i]); ori_outdeg[u[i]]++; } for(int i=0;i<n;i++) {loop[i]=r[i]; cou_loop+=r[i];} for(int i=0;i<n;i++) if(a[i]) ori_outdeg[i]=1; while(!getreach()) continue; for(int i=0;i<n;i++) { res[i]=loop[i]; } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 716 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Incorrect | 1 ms | 424 KB | 3rd lines differ - on the 4th token, expected: '0', found: '1' |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 1100 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 960 KB | Output is correct |
2 | Correct | 9 ms | 900 KB | Output is correct |
3 | Correct | 7 ms | 972 KB | Output is correct |
4 | Correct | 11 ms | 972 KB | Output is correct |
5 | Correct | 13 ms | 1092 KB | Output is correct |
6 | Correct | 19 ms | 972 KB | Output is correct |
7 | Correct | 12 ms | 972 KB | Output is correct |
8 | Correct | 8 ms | 972 KB | Output is correct |
9 | Correct | 9 ms | 968 KB | Output is correct |
10 | Correct | 8 ms | 1100 KB | Output is correct |
11 | Correct | 8 ms | 1100 KB | Output is correct |
12 | Correct | 8 ms | 992 KB | Output is correct |
13 | Correct | 8 ms | 972 KB | Output is correct |
14 | Correct | 7 ms | 972 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 972 KB | Output is correct |
2 | Correct | 9 ms | 1000 KB | Output is correct |
3 | Correct | 8 ms | 972 KB | Output is correct |
4 | Correct | 7 ms | 972 KB | Output is correct |
5 | Correct | 1 ms | 460 KB | Output is correct |
6 | Correct | 5 ms | 716 KB | Output is correct |
7 | Correct | 5 ms | 844 KB | Output is correct |
8 | Incorrect | 6 ms | 844 KB | 3rd lines differ - on the 5th token, expected: '0', found: '1' |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 716 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |