# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
291051 |
2020-09-04T15:56:56 Z |
Saboon |
Toy Train (IOI17_train) |
C++17 |
|
725 ms |
1144 KB |
// Subtask 4
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 10;
int n, m;
vector<int> g[maxn], r;
bool visited[maxn];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
n = a.size(), m = u.size();
for (int i = 0; i < m; i++)
g[u[i]].push_back(v[i]);
vector<int> dp(n), pd(n);
for (int i = 0; i < n; i++){
dp[i] = r[i];
pd[i] = 0;
}
for (int t = 0; t < n; t++){
for (int i = 0; i < n; i++){
if (r[i])
continue;
if (a[i] == 1){
for (auto j : g[i])
dp[i] |= dp[j];
}
else{
int tmp = 1;
for (auto j : g[i])
tmp &= dp[j];
dp[i] = tmp;
}
}
}
for (int i = 0; i < n; i++)
if (r[i] == 1)
for (int j = 0; j < m; j++)
if (u[j] == i and dp[v[j]])
pd[i] = 1;
for (int t = 0; t < n; t++){
for (int i = 0; i < n; i++){
if (a[i] == 1){
for (auto j : g[i])
pd[i] |= pd[j];
}
}
}
for (int t = 0; t < n; t++){
for (int i = 0; i < n; i++){
if (a[i] == 1){
for (auto j : g[i])
pd[i] |= dp[j];
}
else{
int tmp = 1;
for (auto j : g[i])
tmp &= pd[j];
pd[i] = tmp;
}
}
}
return pd;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
320 ms |
768 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 |
Incorrect |
0 ms |
384 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 |
Incorrect |
587 ms |
1144 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 |
Incorrect |
315 ms |
1016 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 |
725 ms |
1144 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 |
320 ms |
768 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |