# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
425696 |
2021-06-13T10:15:48 Z |
Tangent |
Toy Train (IOI17_train) |
C++17 |
|
10 ms |
1028 KB |
#include "train.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
#define ffor(i, a, b) for (ll i = (a); i < (ll)(b); i++)
#define fford(i, a, b) for (ll i = (a); i > (ll)(b); i--)
#define rep(i, n) ffor(i, 0, n)
#define forin(x, a) for (auto &x: a)
#define all(a) a.begin(), a.end()
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
int n = a.size();
vvii adj(n);
rep(i, u.size()) {
adj[u[i]].emplace_back(v[i]);
}
vii res(n, -1);
res[n - 1] = r[n - 1];
fford(i, n - 2, -1) {
if (a[i]) {
res[i] = 0;
forin(j, adj[i]) {
if (j == i) {
res[i] = max(res[i], r[i]);
} else {
res[i] = max(res[i], res[i + 1]);
}
}
} else {
res[i] = 1;
forin(j, adj[i]) {
if (j == i) {
res[i] = min(res[i], r[i]);
} else {
res[i] = min(res[i], res[i + 1]);
}
}
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
772 KB |
Output is correct |
2 |
Correct |
4 ms |
716 KB |
Output is correct |
3 |
Correct |
4 ms |
716 KB |
Output is correct |
4 |
Correct |
4 ms |
716 KB |
Output is correct |
5 |
Correct |
4 ms |
716 KB |
Output is correct |
6 |
Correct |
4 ms |
716 KB |
Output is correct |
7 |
Correct |
5 ms |
716 KB |
Output is correct |
8 |
Correct |
4 ms |
716 KB |
Output is correct |
9 |
Correct |
4 ms |
716 KB |
Output is correct |
10 |
Correct |
4 ms |
716 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 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 |
992 KB |
Output is correct |
2 |
Correct |
7 ms |
1004 KB |
Output is correct |
3 |
Correct |
10 ms |
972 KB |
Output is correct |
4 |
Incorrect |
10 ms |
1000 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 |
6 ms |
844 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 |
1028 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 |
5 ms |
772 KB |
Output is correct |
2 |
Correct |
4 ms |
716 KB |
Output is correct |
3 |
Correct |
4 ms |
716 KB |
Output is correct |
4 |
Correct |
4 ms |
716 KB |
Output is correct |
5 |
Correct |
4 ms |
716 KB |
Output is correct |
6 |
Correct |
4 ms |
716 KB |
Output is correct |
7 |
Correct |
5 ms |
716 KB |
Output is correct |
8 |
Correct |
4 ms |
716 KB |
Output is correct |
9 |
Correct |
4 ms |
716 KB |
Output is correct |
10 |
Correct |
4 ms |
716 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
12 |
Incorrect |
1 ms |
204 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
13 |
Halted |
0 ms |
0 KB |
- |