이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "train.h"
using namespace std;
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n = a.size(), m = u.size();
vector <int> has_self (n);
vector <int> has_next (n);
vector <int> rs (n, 1);
for (int i = 0; i < m; i++){
if (u[i] == v[i]) {
has_self[u[i]] = 1;
}
else has_next[u[i]] = 1;
}
for (int i = 0; i < n; i++){
int ct = 0;
for (int j = i; ct <= n; j = (j + 1) % n, ct++) {
if ((has_self[j] && a[j] == 0 && !r[j]) || (!has_next[j] && r[j])) {
rs[i] = 0;
break;
}
if (has_self[j] && a[j] == 1 && r[j]) break;
if (!has_next[j]) break;
}
}
return rs;
}
# | 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... |