# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
836139 | 2023-08-24T07:52:55 Z | kamelfanger83 | 장난감 기차 (IOI17_train) | C++14 | 8 ms | 1620 KB |
#include <vector> #include <iostream> #include <queue> #include "train.h" using namespace std; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v){ int n = a.size(); vector<vector<int>> edg (n), revedg (n); vector<int> recharg; for (int i = 0; i < n; ++i) { if (r[i]) recharg.push_back(i); } for (int i = 0; i < u.size(); ++i) { edg[u[i]].push_back(v[i]); revedg[v[i]].push_back(u[i]); } queue<int> addWin; for (int i : recharg) addWin.push(i); vector<int> res (n); vector<int> outwin (n); while(!addWin.empty()){ int i = addWin.front(); addWin.pop(); res[i] = true; for (int re : revedg[i]){ outwin[re]++; if (a[re] && outwin[re] == 1) addWin.push(re); else if (!a[re] && outwin[re] == edg[re].size()) addWin.push(re); } } while (true){ queue<int> rWin; for (int i : recharg){ if (res[i]){ if (a[i] && !outwin[i]) rWin.push(i); else if (!a[i] && outwin[i] < edg[i].size()) rWin.push(i); } } if (rWin.empty()) break; while (!rWin.empty()){ int i = rWin.front(); rWin.pop(); res[i] = false; for (int re : revedg[i]){ outwin[re]--; if (a[re] && outwin[re] == 0) rWin.push(re); else if (!a[re] && outwin[re] == edg[re].size() - 1) rWin.push(re); } } } return res; } /* int main(){ auto ret = who_wins({0, 1}, {1, 0}, {0, 0, 1, 1}, {0, 1, 0, 1}); for (int i : ret) cout << i << " "; return 0; }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 1108 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1620 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1336 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1492 KB | Output is correct |
2 | Correct | 6 ms | 1588 KB | Output is correct |
3 | Correct | 7 ms | 1492 KB | Output is correct |
4 | Correct | 8 ms | 1484 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 4 ms | 1108 KB | Output is correct |
7 | Correct | 4 ms | 980 KB | Output is correct |
8 | Incorrect | 4 ms | 980 KB | 3rd lines differ - on the 5th token, expected: '0', found: '1' |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 1108 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |