# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
289113 | 2020-09-02T11:15:20 Z | SamAnd | Toy Train (IOI17_train) | C++17 | 24 ms | 25472 KB |
#include "train.h" #include <bits/stdc++.h> using namespace std; #define m_p make_pair #define fi first #define se second #define all(x) (x).begin(),(x).end() #define sz(x) ((int)(x).size()) typedef long long ll; const int N = 5003; int n; vector<int> a, r; vector<int> g[N]; bool u[N][N]; vector<int> solv1() { vector<int> ans(n); for (int i = n - 1; i >= 0; --i) { if (a[i]) { if (r[i]) { if (u[i][i]) { ans[i] = 1; } else { ans[i] = ans[i + 1]; } } else { if (u[i][i + 1]) { ans[i] = ans[i + 1]; } else { ans[i] = 0; } } } else { if (!r[i]) { if (u[i][i]) { ans[i] = 0; } else { ans[i] = ans[i + 1]; } } else { if (u[i][i + 1]) { ans[i] = ans[i + 1]; } else { ans[i] = 1; } } } } return ans; } std::vector<int> who_wins(std::vector<int> A, std::vector<int> R, std::vector<int> U, std::vector<int> V) { a = A; r = R; n = sz(a); bool z1 = true; for (int i = 0; i < sz(U); ++i) { int x = U[i]; int y = V[i]; g[x].push_back(y); u[x][y] = true; if (x != y && x + 1 != y) z1 = false; } if (z1) return solv1(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 20992 KB | Output is correct |
2 | Correct | 18 ms | 20992 KB | Output is correct |
3 | Correct | 16 ms | 20992 KB | Output is correct |
4 | Correct | 15 ms | 20992 KB | Output is correct |
5 | Correct | 18 ms | 20992 KB | Output is correct |
6 | Correct | 18 ms | 20992 KB | Output is correct |
7 | Correct | 15 ms | 20992 KB | Output is correct |
8 | Correct | 17 ms | 20980 KB | Output is correct |
9 | Correct | 16 ms | 20992 KB | Output is correct |
10 | Correct | 15 ms | 20992 KB | Output is correct |
11 | Correct | 15 ms | 20992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 512 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 | Correct | 21 ms | 20480 KB | Output is correct |
2 | Correct | 19 ms | 21496 KB | Output is correct |
3 | Correct | 19 ms | 22400 KB | Output is correct |
4 | Incorrect | 24 ms | 25472 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 | 19 ms | 24448 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 | 22 ms | 24952 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 | 15 ms | 20992 KB | Output is correct |
2 | Correct | 18 ms | 20992 KB | Output is correct |
3 | Correct | 16 ms | 20992 KB | Output is correct |
4 | Correct | 15 ms | 20992 KB | Output is correct |
5 | Correct | 18 ms | 20992 KB | Output is correct |
6 | Correct | 18 ms | 20992 KB | Output is correct |
7 | Correct | 15 ms | 20992 KB | Output is correct |
8 | Correct | 17 ms | 20980 KB | Output is correct |
9 | Correct | 16 ms | 20992 KB | Output is correct |
10 | Correct | 15 ms | 20992 KB | Output is correct |
11 | Correct | 15 ms | 20992 KB | Output is correct |
12 | Incorrect | 1 ms | 512 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
13 | Halted | 0 ms | 0 KB | - |