이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
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... |