이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
namespace {
int dist[20005];
vector<int> edges;
vector<pi> AdjList[20005];
queue<int> q;
} // 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){
dist[i] = 1e9;
AdjList[i].clear();
}
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));
}
dist[0] = 0;
q.push(0);
while (!q.empty()){
int x = q.front();
q.pop();
for (auto it : AdjList[x]){
if (edges[it.second] != -1) continue;
if (dist[it.first] > dist[x] + 1){
dist[it.first] = dist[x] + 1;
q.push(it.first);
}
edges[it.second] = dist[x]%A;
//cerr << x << ' ' << it.first << ' ' << edges[it.second] << '\n';
}
}
/*
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 A;
vector<int> a0 = {0,1};
vector<int> a1 = {1,2};
vector<int> a2 = {2,3};
vector<int> a3 = {0,3};
vector<int> b0 = {0,1};
vector<int> b1 = {1,2};
vector<int> b2 = {0,2};
} // namespace
void Init(int A, int B) {
::A = A;
}
int Move(std::vector<int> y) {
/*
for (auto it : y){
cerr << it << ' ';
}
cerr << "\n\n";
*/
vector<int> x;
for (int i = 0; i < y.size(); ++i){
if (y[i]) x.push_back(i);
}
assert(x.size() <= 2);
if (x.size() == 1) return x[0];
if (::A == 3){
if (x == b0){
return 0;
}
if (x == b1){
return 1;
}
if (x == b2){
return 2;
}
}
if (::A == 4){
if (x == a0){
return 0;
}
if (x == a1){
return 1;
}
if (x == a2){
return 2;
}
if (x == a3){
return 3;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:31:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < y.size(); ++i){
~~^~~~~~~~~~
Catherine.cpp:62: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... |