이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 42;
bool ch[N];
int n, m, val[N][2];
vector<int> adj[N];
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[v[i]].push_back(u[i]);
for(int i = 0; i < 2*n + 2; i++) {
for(int j = 0; j < n; j++)
if(r[j] == 1)
val[j][i % 2] += n;
for(int j = 0; j < n; j++)
val[j][1 - (i % 2)] = 0;
for(int j = 0; j < n; j++) {
for(int k : adj[j]) {
val[k][1 - (i % 2)] = max(val[k][1 - (i % 2)], val[j][i % 2] - 1);
}
}
}
int i = 2*n + 2;
if(r[i] == 1)
val[i][i % 2] += n;
for(int j = 0; j < n; j++)
val[j][1 - (i % 2)] = 0;
for(int j = 0; j < n; j++)
for(int k : adj[j])
if(val[k][1 - (i % 2)] < val[j][i % 2] - 1)
ch[k] = true;
vector<int> res(n);
for(int i = 0; i < n; i++)
if(ch[i])
res[i] = true;
return res;
}
# | 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... |