# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68247 | 2018-08-16T09:50:56 Z | Talant | Toy Train (IOI17_train) | C++17 | 1282 ms | 25056 KB |
#include "train.h" //#include "grader.cpp" #include <bits/stdc++.h> #define mk make_pair #define sc second #define fr first #define pb push_back using namespace std; const int N = (1e6 + 5); const int inf = (1e9 + 7); int pr[N]; bool f[N]; bool was[N]; vector <int> g[N],res; void dfs (int e,int v) { was[v] = 1; for (auto to : g[v]) { if (!was[to]) { pr[to] = v; dfs(e,to); } else if (was[to] && to == e) { f[to] = 1,f[v] = 1; } f[v] |= f[to]; } } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { for (int i = 0; i < u.size(); i ++) g[u[i]].pb(v[i]); for (int i = 0; i < a.size(); i ++) res.pb(0); for (int i = 0; i < r.size(); i ++) { if (r[i]) { for (int j = 0; j < r.size(); j ++) was[j] = 0,f[j] = 0; dfs(i,i); for (int j = 0; j < r.size(); j ++) { res[j] |= f[j]; } } } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 229 ms | 24568 KB | 3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 24568 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 | 48 ms | 24732 KB | Output is correct |
2 | Correct | 105 ms | 24748 KB | Output is correct |
3 | Correct | 128 ms | 24916 KB | Output is correct |
4 | Incorrect | 469 ms | 25056 KB | 3rd lines differ - on the 13th token, expected: '1', found: '0' |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1282 ms | 25056 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 36 ms | 25056 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 | 229 ms | 24568 KB | 3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |