이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
#define N ((int)100)
int n,m;
bool e[N][N],mark[N];
vector <int> now;
bool solve(vector <int> &a,vector <int> &r)
{
int x=now.back();
bool flg=0;
for(int i=(int)now.size()-1;i>=0;i--)
{
flg|=r[now[i]];
if(e[x][now[i]] && flg==a[x])return a[x];
}
for(int i=0;i<n;i++)
{
// int i=arr[j];
if(mark[i] || !e[x][i])continue;
now.push_back(i);mark[i]=1;
if(solve(a,r)==a[x])
{
now.pop_back();mark[i]=0;
return a[x];
}
now.pop_back();mark[i]=0;
}
return 1-a[x];
}
vector<int> who_wins(vector<int> a,vector<int> r,vector<int> u,vector<int> v)
{
n=a.size();m=u.size();
memset(e,0,sizeof e);
memset(mark,0,sizeof mark);
now.clear();
//for(int i=0;i<n;i++)arr[i]=i;
for(int i=0;i<m;i++)e[u[i]][v[i]]=1;
vector <int> res;
for(int i=0;i<n;i++)
{
now.push_back(i);mark[i]=1;
res.push_back(solve(a,r));
now.pop_back();mark[i]=0;
}
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... |