# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1045588 | 2024-08-06T06:02:42 Z | pcc | 장난감 기차 (IOI17_train) | C++17 | 585 ms | 4504 KB |
#include "train.h" #include <bits/stdc++.h> using namespace std; const int mxn = 5050; vector<int> charge; int N,M; queue<int> q; int owner[mxn]; bitset<mxn> reach[mxn],dist; vector<int> paths[mxn]; bitset<mxn> ban; void BFS(int s = -1){ if(s != -1){ dist.reset(); q.push(s); } while(!q.empty()){ auto now = q.front(); q.pop(); for(auto nxt:paths[now]){ if(!dist[nxt]&&!ban[nxt]){ dist[nxt] = 1; q.push(nxt); } } } return; } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { N = a.size(); for(int i = 0;i<N;i++){ owner[i] = a[i]; if(r[i]){ charge.push_back(i); ban[i] = true; } } for(int i = 0;i<u.size();i++){ int aa = u[i],bb = v[i]; paths[aa].push_back(bb); } for(int i = 0;i<N;i++){ BFS(i); reach[i] = dist; } vector<int> ans(N); for(int i = 0;i<N;i++){ for(int j = 0;j<N;j++){ if(!ban[j]&&reach[i][j]&&reach[j][j])ans[i] = 1; } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 4068 KB | 3rd lines differ - on the 5th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 111 ms | 4504 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 4188 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 585 ms | 4256 KB | 3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 4068 KB | 3rd lines differ - on the 5th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |