This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 10 + 42, INF = 1e9;
int n, m, dp[N*N][N];
vector<int> adj[N], ans;
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++)
adj[u[i]].push_back(v[i]);
for(int i = 0; i < n*n+42; i++) {
for(int j = 0; j < n; j++) {
dp[i+1][j] = dp[i][j];
if(a[j]) {
for(int k : adj[j])
dp[i+1][j] = max(dp[i+1][j], dp[i][k]);
} else {
for(int k : adj[j])
dp[i+1][j] = min(dp[i+1][j], dp[i][k]);
}
if(r[j])
dp[i+1][j]++;
}
}
for(int j = 0; j < n; j++)
ans.push_back((dp[n*n+42][j] > n));
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |