# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
836158 | 2023-08-24T08:06:23 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(); if (res[i]) continue; 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); } } 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); } } while (!rWin.empty()){ int i = rWin.front(); rWin.pop(); if (!res[i]) continue; 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({1, 1}, {0, 1}, {1, 0}, {0, 0}); for (int i : ret) cout << i << " "; return 0; }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 980 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | 3rd lines differ - on the 4th token, expected: '0', found: '1' |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1364 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1236 KB | Output is correct |
2 | Correct | 8 ms | 1364 KB | Output is correct |
3 | Correct | 6 ms | 1492 KB | Output is correct |
4 | Correct | 6 ms | 1492 KB | Output is correct |
5 | Correct | 6 ms | 1492 KB | Output is correct |
6 | Correct | 6 ms | 1492 KB | Output is correct |
7 | Correct | 7 ms | 1464 KB | Output is correct |
8 | Correct | 5 ms | 1492 KB | Output is correct |
9 | Correct | 5 ms | 1492 KB | Output is correct |
10 | Correct | 6 ms | 1620 KB | Output is correct |
11 | Correct | 7 ms | 1620 KB | Output is correct |
12 | Correct | 7 ms | 1620 KB | Output is correct |
13 | Correct | 6 ms | 1492 KB | Output is correct |
14 | Correct | 5 ms | 1492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1364 KB | Output is correct |
2 | Correct | 6 ms | 1500 KB | Output is correct |
3 | Correct | 8 ms | 1492 KB | Output is correct |
4 | Correct | 6 ms | 1364 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 5 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 | 3 ms | 980 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |