# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1070783 | 2024-08-22T18:26:47 Z | Ahmed57 | 장난감 기차 (IOI17_train) | C++17 | 166 ms | 1572 KB |
#include "bits/stdc++.h" using namespace std; vector<int> who_wins(vector<int> a,vector<int> r,vector<int> u,vector<int> v){ int n = a.size(); int m = u.size(); vector<int> adj[n+1],rev[n+1]; for(int i = 0;i<u.size();i++){ adj[u[i]].push_back(v[i]); rev[v[i]].push_back(u[i]); } vector<int> ans(n,1); int deg[n+1] = {0}; int vis[n+1] = {0}; int ch[n+1] = {0}; while(1){ for(int i = 0;i<n;i++){ if(ans[i]){ vis[i] = 0;ch[i] = 0; deg[i] = 0; for(auto j:adj[i]){ if(ans[j])deg[i]++; } } } queue<int> q; for(int i = 0;i<n;i++){ if(ans[i]&&r[i]){ q.push(i); } } while(!q.empty()){ int x = q.front();q.pop(); if(ch[x])continue; ch[x] = 1; for(auto i:rev[x]){ deg[i]--; if(ans[i]&&(deg[i]==0||a[i]==1)&&!vis[i]){ vis[i] = 1; q.push(i); } } } bool upd = 0; for(int i = 0;i<n;i++){ int old = ans[i]; ans[i]&=vis[i]; if(old!=ans[i])upd = 1; } if(upd==0)break; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 1112 KB | 3rd lines differ - on the 42nd token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 61 ms | 1372 KB | Output is correct |
2 | Correct | 109 ms | 1368 KB | Output is correct |
3 | Correct | 148 ms | 1572 KB | Output is correct |
4 | Correct | 6 ms | 1372 KB | Output is correct |
5 | Correct | 10 ms | 1372 KB | Output is correct |
6 | Correct | 9 ms | 1352 KB | Output is correct |
7 | Correct | 5 ms | 1372 KB | Output is correct |
8 | Correct | 5 ms | 1388 KB | Output is correct |
9 | Correct | 5 ms | 1368 KB | Output is correct |
10 | Correct | 5 ms | 1516 KB | Output is correct |
11 | Correct | 5 ms | 1372 KB | Output is correct |
12 | Correct | 4 ms | 1372 KB | Output is correct |
13 | Correct | 6 ms | 1372 KB | Output is correct |
14 | Correct | 5 ms | 1528 KB | Output is correct |
15 | Correct | 6 ms | 1372 KB | Output is correct |
16 | Correct | 5 ms | 1368 KB | Output is correct |
17 | Correct | 5 ms | 1372 KB | Output is correct |
18 | Correct | 166 ms | 1116 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1368 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1372 KB | Output is correct |
2 | Correct | 6 ms | 1368 KB | Output is correct |
3 | Correct | 10 ms | 1392 KB | Output is correct |
4 | Correct | 5 ms | 1372 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 3 ms | 1116 KB | Output is correct |
7 | Correct | 3 ms | 856 KB | Output is correct |
8 | Correct | 4 ms | 860 KB | Output is correct |
9 | Correct | 3 ms | 860 KB | Output is correct |
10 | Correct | 2 ms | 604 KB | Output is correct |
11 | Correct | 3 ms | 860 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 1112 KB | 3rd lines differ - on the 42nd token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |