#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 20;
const int M = 5010;
bitset < N > win[2][N * N];
int n , m;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
n = a.size();
m = u.size();
vector<int> res;
for(int i=0;i<n;i++) win[0][0][i] = r[i];
for(int i=1;i<=n;i++){
for(int j=0;j<n;j++) win[0][i][j] = (r[j] == 1 ? 1 : (a[j] ^ 1));
for(int j=0;j<m;j++){
if(r[u[j]]) continue;
if(a[u[j]]){
if(win[0][i-1][v[j]] == 1) win[0][i][u[j]] = 1;
}
else{
if(win[0][i-1][v[j]] == 0) win[0][i][u[j]] = 0;
}
}
}
for(int i=0;i<n;i++) win[1][0][i] = win[0][n][i];
int cur = m * n;
for(int i=1;i<=cur;i++){
for(int j=0;j<n;j++) win[1][i][j] = (win[0][n][j] == 0 ? 0 : a[j] ^ 1);
for(int j=0;j<m;j++){
if(a[u[j]]){
if(win[1][i-1][v[j]] == 1) win[1][i][u[j]] = 1;
}
else{
if(win[1][i-1][v[j]] == 0) win[1][i][u[j]] = 0;
}
}
}
for(int i=0;i<n;i++) res.push_back(win[1][cur][i]);
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
343 ms |
2164 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
2024 KB |
Execution killed because of forbidden syscall writev (20) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
273 ms |
2372 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
133 ms |
2372 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
469 ms |
2372 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
343 ms |
2164 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |