이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5010;
int n, m, a[maxn], r[maxn], cycle[maxn], nxt[maxn];
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 < n; i ++)
a[i] = A[i];
for (int i = 0; i < n; i ++)
r[i] = R[i];
for (int i = 0; i < m; i ++)
{
if (U[i] == V[i])
{
cycle[U[i]] = 1;
///cout << "HERE" << endl;
}
else
{
nxt[U[i]] = 1;
}
}
vector < int > res(n, 0);
for (int i = 0; i < n; i ++)
{
int j = i;
while(true)
{
///cout << i << " : " << j << endl;
if (cycle[j])
{
//cout << "here" << endl;
if (a[j] == 1)
{
if (r[j])
{
res[i] = 1;
break;
}
}
else
{
if (!r[j])
{
res[i] = 0;
break;
}
}
}
if (nxt[j])
{
j ++;
}
else
{
if (a[j] == 0)
res[i] = 1;
break;
}
}
}
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... |