# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068303 | 2024-08-21T09:10:24 Z | edogawa_something | Toy Train (IOI17_train) | C++17 | 1345 ms | 2084 KB |
#include "train.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pii; typedef vector<ll> vii; #define F first #define S second #define all(v) v.begin(),v.end() #define pb push_back vii adj[5001],radj[5001]; vector<int>a,r; bool vis[5001],viss[5001]; void dfs(ll x) { if(vis[x]) return; vis[x]=1; for(auto it:adj[x]) dfs(it); } void rdfs(ll x) { if(viss[x]) return; viss[x]=1; for(auto it:radj[x]) rdfs(it); } bool chk[5001]; vector<int>ans; vector<int> who_wins(std::vector<int> A, std::vector<int> R, std::vector<int> u, std::vector<int> v) { a=A,r=R; ans.resize(a.size()); for(int i=0;i<u.size();i++) adj[u[i]].pb(v[i]),radj[v[i]].pb(u[i]); for(int i=0;i<a.size();i++) { for(int j=0;j<a.size();j++) vis[j]=viss[j]=0; if(r[i]) { for(auto it:adj[i]) { if(it==i) chk[i]=1; } dfs(i),rdfs(i); for(int j=0;j<a.size();j++) { if(j==i) continue; if(vis[j]&&viss[j]) chk[i]=1; } if(chk[i]) { for(int j=0;j<a.size();j++) ans[j]|=(viss[j]); } } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 203 ms | 1412 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 604 KB | 3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 2084 KB | Output is correct |
2 | Correct | 100 ms | 1884 KB | Output is correct |
3 | Correct | 143 ms | 2020 KB | Output is correct |
4 | Correct | 462 ms | 2040 KB | Output is correct |
5 | Correct | 83 ms | 1988 KB | Output is correct |
6 | Correct | 67 ms | 1852 KB | Output is correct |
7 | Correct | 484 ms | 1936 KB | Output is correct |
8 | Correct | 6 ms | 1884 KB | Output is correct |
9 | Correct | 6 ms | 1816 KB | Output is correct |
10 | Correct | 9 ms | 1880 KB | Output is correct |
11 | Correct | 6 ms | 1744 KB | Output is correct |
12 | Correct | 6 ms | 1624 KB | Output is correct |
13 | Correct | 6 ms | 1848 KB | Output is correct |
14 | Correct | 7 ms | 1884 KB | Output is correct |
15 | Correct | 6 ms | 1880 KB | Output is correct |
16 | Correct | 7 ms | 1880 KB | Output is correct |
17 | Correct | 6 ms | 1944 KB | Output is correct |
18 | Correct | 258 ms | 1484 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1345 ms | 1748 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 1884 KB | 3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 203 ms | 1412 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |