# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
612463 | 2022-07-29T15:29:29 Z | MohamedAliSaidane | 장난감 기차 (IOI17_train) | C++14 | 1049 ms | 1812 KB |
#include <bits/stdc++.h> //#include "train.h" using namespace std; typedef long long ll; typedef double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpi; typedef vector<pll> vpl; #define pb push_back #define popb pop_back #define all(x) (x).begin(),(x).end() #define ff first #define ss second const int nax = 5004; const int MOD = 1e9 + 7; int n, m ; vi adj[nax], rev_adj[nax]; int cnt[nax], sz[nax]; vi who_wins(vi a, vi r, vi u, vi v) { set<int> cur; n = a.size(); m = u.size(); int org; for(int i = 0 ; i < n; i++) { if(r[i]) { cur.insert(i); org = i; } } for(int i= 0; i < m; i ++) { adj[u[i]].pb(v[i]); rev_adj[v[i]].pb(u[i]); } for(int i = 0 ; i < n; i ++ ) sz[i] = (int)(adj[i].size()); for(auto e: cur) { for(auto o: rev_adj[e]) cnt[o]++; } for(int i = 0 ; i < n; i++) { set<int> nw; for(int j= 0; j < n; j ++) { if(cur.count(j) !=0 || nw.count(j) != 0) continue; if(a[j]) { if(cnt[j] > 0) nw.insert(j); } else { if(cnt[j] == sz[j]) nw.insert(j); } } for(auto e: nw) { for(auto o: rev_adj[e]) cnt[o] ++ ; cur.insert(e); } } vi ans(n, 0); if(a[org]) { if(cnt[org] > 0 ) { for(auto e: cur) ans[e] = 1; } } else { if(cnt[org] == sz[org]) for(auto e: cur) ans[e] = 1; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 996 ms | 1364 KB | 3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 468 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1049 ms | 1792 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 990 ms | 1612 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 978 ms | 1688 KB | Output is correct |
2 | Correct | 1037 ms | 1812 KB | Output is correct |
3 | Correct | 1038 ms | 1756 KB | Output is correct |
4 | Correct | 985 ms | 1700 KB | Output is correct |
5 | Correct | 1 ms | 596 KB | Output is correct |
6 | Correct | 221 ms | 1084 KB | Output is correct |
7 | Correct | 11 ms | 1196 KB | Output is correct |
8 | Correct | 12 ms | 1296 KB | Output is correct |
9 | Correct | 11 ms | 1236 KB | Output is correct |
10 | Correct | 2 ms | 724 KB | Output is correct |
11 | Correct | 21 ms | 1168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 996 ms | 1364 KB | 3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |