이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
namespace {
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
vector<int> edges;
vector<pi> AdjList[20005];
queue<int> q;
int cnt[12] = {1,0,0,1,0,1,1,0,0,1,0,1};
void genchain(int x, int p, int eweight){
//cerr << x << ' ' << p << ' ' << eweight << '\n';
int c = 0;
for (auto it : AdjList[x]){
if (it.first == p) continue;
c++;
}
if (c >= 2){
if (eweight == 1) cdepth[x] = 1;
else cdepth[x] = 0;
for (auto it : AdjList[x]){
if (it.first == p) continue;
cdepth[it.first] = cdepth[x] + 1;
edges[it.second] = cnt[cdepth[x]%12];
genchain(it.first,x,edges[it.second]);
}
}
else{
for (auto it : AdjList[x]){
if (it.first == p) continue;
cdepth[it.first] = cdepth[x] + 1;
edges[it.second] = cnt[cdepth[x]%12];
genchain(it.first,x,edges[it.second]);
}
}
}
} // namespace
vector<int> Mark(int N, int M, int A, int B,vector<int> U,vector<int> V) {
for (int i = 0; i < N; ++i){
AdjList[i].clear();
cdepth[i] = -1;
}
edges.resize(M,-1);
for (int i = 0; i < M; ++i){
AdjList[U[i]].push_back(pi(V[i],i));
AdjList[V[i]].push_back(pi(U[i],i));
}
cdepth[0] = 0;
genchain(0,-1,0);
for (auto it : edges){
//cerr << it << ' ';
}
//cerr << '\n';
return edges;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
namespace {
int stage = 0;
int cnt[12] = {1,0,0,1,0,1,1,0,0,1,0,1};
int br[12][5];
vector<int> last;
} // namespace
void Init(int A, int B) {
last.clear();
stage = 0;
for (int i = 0; i < 12; ++i){
for (int j = 0; j < 5; ++j){
br[i][j] = cnt[(i+j)%12];
}
}
}
int Move(std::vector<int> y) {
/*
cerr << stage << '\n';
for (auto it : last){
cerr << it << ' ';
}
cerr << '\n';
*/
int mv = -1;
if (stage == 0){
if (y[0] + y[1] == 1){
stage = 2;
if (y[0]){
last.push_back(0);
return 0;
}
else{
last.push_back(1);
return 1;
}
}
else if (y[0] + y[1] > 2){
stage = 2;
if (y[0] == 1) mv = 0;
else mv = 1;
last.push_back(mv);
return mv;
}
stage = 1;
if (y[0] == 2){
last.push_back(0);
last.push_back(0);
return 0;
}
else if (y[1] == 2){
last.push_back(1);
last.push_back(1);
return 1;
}
else{
if (y[0] != 0) mv = 0;
else mv = 1;
last.push_back(1-mv);
last.push_back(mv);
return mv;
}
}
else if (stage == 1){
if (y[0] + y[1] == 1){
if (last.size() >= 4){
int checkers[12];
for (int i = 0; i < 12; ++i) checkers[i] = 1;
last.push_back((y[0] == 1 ? 0 : 1));
for (int i = 0; i < 5; ++i){
for (int j = 0; j < 12; ++j){
if (last[i] != br[j][i]) checkers[j] = 0;
}
}
last.pop_back();
for (int i = 0; i < 12; ++i){
if (checkers[i]){
stage = 2;
last.push_back(last.back());
return -1;
}
}
}
}
if (y[0] == 0 && y[1] == 0){
stage = 2;
last.push_back(last.back());
return -1;
}
else if (y[0] + y[1] == 1){
if (y[0] == 1) mv = 0;
else mv = 1;
last.push_back(mv);
return mv;
}
else{
stage = 2;
if (y[0] == 0){
last.push_back(last.back());
return -1;
}
else if (y[1] == 0){
last.push_back(last.back());
return -1;
}
else{
int x = last.back();
last.push_back(1-x);
return 1-x;
}
}
}
else{
if (y[0] + y[1] == 1){
if (y[1] == 1){
last.push_back(1);
return 1;
}
if (y[0] == 1){
last.push_back(0);
return 0;
}
}
else{
int x = last.back();
last.push_back(1-x);
return 1-x;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:57:12: warning: unused variable 'it' [-Wunused-variable]
for (auto it : edges){
^~
Anthony.cpp: At global scope:
Anthony.cpp:10:54: warning: '{anonymous}::rev' defined but not used [-Wunused-variable]
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
^~~
Anthony.cpp:10:29: warning: '{anonymous}::w' defined but not used [-Wunused-variable]
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
^
Anthony.cpp:10:18: warning: '{anonymous}::hv' defined but not used [-Wunused-variable]
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
^~
Anthony.cpp:10:6: warning: '{anonymous}::sub' defined but not used [-Wunused-variable]
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
^~~
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:144:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |