# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
291401 | 2020-09-05T10:07:37 Z | abyyskit | Toy Train (IOI17_train) | C++14 | 9 ms | 1280 KB |
#include "train.h" #include<bits/stdc++.h> using namespace std; #define FOR(i, x, y) for(int i = x; i < y; ++i) #define pb push_back struct node{ vector<int> e; bool charge = false; bool A = false; }; vector<node> g; vector<int> subtask1(){ vector<int> ans(g.size(), 0); for(int i = g.size() - 1; i >= 0; --i){ if (g[i].A){ ans[i] = 0; } else{ ans[i] = 1; } FOR(j, 0, g[i].e.size()){ int nex = g[i].e[j]; // cout << "nex: " << nex << "\n"; if (g[i].A){ if (g[i].charge && nex == i){ ans[i] = 1; break; } if (nex != i){ ans[i] = max(ans[i], ans[i + 1]); } } else{ if (nex == i){ if (!g[i].charge){ ans[i] = 0; break; } } else{ ans[i] = min(ans[i], ans[i + 1]); } } } } return ans; } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v){ g.resize(a.size()); FOR(i, 0, u.size()){ g[u[i]].e.pb(v[i]); } // cout << "here\n"; FOR(i, 0, a.size()){ if (a[i] == 1){ g[i].A = true; } if (r[i] == 1){ g[i].charge = true; } } // cout << "here2" << "\n"; return subtask1(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 896 KB | Output is correct |
2 | Correct | 5 ms | 896 KB | Output is correct |
3 | Correct | 5 ms | 896 KB | Output is correct |
4 | Correct | 5 ms | 896 KB | Output is correct |
5 | Correct | 5 ms | 896 KB | Output is correct |
6 | Correct | 4 ms | 896 KB | Output is correct |
7 | Correct | 5 ms | 896 KB | Output is correct |
8 | Correct | 5 ms | 896 KB | Output is correct |
9 | Correct | 5 ms | 896 KB | Output is correct |
10 | Correct | 4 ms | 896 KB | Output is correct |
11 | Correct | 4 ms | 896 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | 3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1280 KB | Output is correct |
2 | Correct | 8 ms | 1280 KB | Output is correct |
3 | Correct | 8 ms | 1280 KB | Output is correct |
4 | Incorrect | 9 ms | 1280 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 1152 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 | 9 ms | 1280 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 | Correct | 4 ms | 896 KB | Output is correct |
2 | Correct | 5 ms | 896 KB | Output is correct |
3 | Correct | 5 ms | 896 KB | Output is correct |
4 | Correct | 5 ms | 896 KB | Output is correct |
5 | Correct | 5 ms | 896 KB | Output is correct |
6 | Correct | 4 ms | 896 KB | Output is correct |
7 | Correct | 5 ms | 896 KB | Output is correct |
8 | Correct | 5 ms | 896 KB | Output is correct |
9 | Correct | 5 ms | 896 KB | Output is correct |
10 | Correct | 4 ms | 896 KB | Output is correct |
11 | Correct | 4 ms | 896 KB | Output is correct |
12 | Incorrect | 1 ms | 256 KB | 3rd lines differ - on the 2nd token, expected: '1', found: '0' |
13 | Halted | 0 ms | 0 KB | - |