# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
608809 |
2022-07-27T10:20:26 Z |
Mounir |
Toy Train (IOI17_train) |
C++14 |
|
1621 ms |
48380 KB |
#include "train.h"
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define chmax(x, v) x = max(x, v)
#define chmin(x, v) x = min(x, v)
#define pb push_back
#define pii pair<int, int>
#define sz(x) (int)x.size()
#define x first
#define y second;
using namespace std;
const int N = 1e6;
bool aAlice[N];
vector<int> versMoi[N], voisins[N];
int fuckes[N];
int nNoeuds;
bool aAcces[N];
bool estRecharge[N];
void updRecharges(){
queue<int> file;
for (int noeud = 0; noeud < nNoeuds; ++noeud){
aAcces[noeud] = false;
if (estRecharge[noeud])
file.push(noeud);
fuckes[noeud] = sz(voisins[noeud]);
}
while (!file.empty()){
int noeud = file.front();
file.pop();
for (int avant : versMoi[noeud]){
fuckes[avant] -= (estRecharge[noeud]^aAcces[noeud]);
if ((aAlice[avant] || fuckes[avant] == 0) && !aAcces[avant]){
file.push(avant);
aAcces[avant] = true;
}
}
}
for (int noeud = 0; noeud < nNoeuds; ++noeud)
estRecharge[noeud] &= aAcces[noeud];
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
nNoeuds = sz(a);
for (int noeud = 0; noeud < nNoeuds; ++noeud){
aAlice[noeud] = a[noeud];
estRecharge[noeud] = r[noeud];
}
int nAretes = sz(u);
for (int i = 0; i < nAretes; ++i){
voisins[u[i]].pb(v[i]);
versMoi[v[i]].pb(u[i]);
}
for (int i = 0; i < nNoeuds; ++i)
updRecharges();
vector<int> res(nNoeuds);
for (int i = 0; i < nNoeuds; ++i){
res[i] = aAcces[i];
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
555 ms |
47900 KB |
3rd lines differ - on the 50th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47156 KB |
Output is correct |
2 |
Correct |
23 ms |
47260 KB |
Output is correct |
3 |
Incorrect |
23 ms |
47216 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
203 ms |
48380 KB |
Output is correct |
2 |
Correct |
271 ms |
48160 KB |
Output is correct |
3 |
Correct |
318 ms |
48156 KB |
Output is correct |
4 |
Correct |
1336 ms |
48140 KB |
Output is correct |
5 |
Correct |
852 ms |
48120 KB |
Output is correct |
6 |
Correct |
157 ms |
48120 KB |
Output is correct |
7 |
Correct |
1621 ms |
48128 KB |
Output is correct |
8 |
Correct |
519 ms |
48108 KB |
Output is correct |
9 |
Correct |
136 ms |
48104 KB |
Output is correct |
10 |
Correct |
839 ms |
48076 KB |
Output is correct |
11 |
Correct |
616 ms |
48056 KB |
Output is correct |
12 |
Correct |
148 ms |
48156 KB |
Output is correct |
13 |
Correct |
1306 ms |
48128 KB |
Output is correct |
14 |
Correct |
1242 ms |
48124 KB |
Output is correct |
15 |
Correct |
1277 ms |
48128 KB |
Output is correct |
16 |
Correct |
1249 ms |
48124 KB |
Output is correct |
17 |
Correct |
1216 ms |
48128 KB |
Output is correct |
18 |
Correct |
377 ms |
47868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
149 ms |
48132 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 |
851 ms |
48320 KB |
Output is correct |
2 |
Correct |
1454 ms |
48124 KB |
Output is correct |
3 |
Correct |
1344 ms |
48144 KB |
Output is correct |
4 |
Correct |
1421 ms |
48032 KB |
Output is correct |
5 |
Incorrect |
26 ms |
47356 KB |
3rd lines differ - on the 9th token, expected: '1', found: '0' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
555 ms |
47900 KB |
3rd lines differ - on the 50th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |