이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
namespace {
vector<int> strat1(int N, int M, int A, int B,
vector<int> U, std::vector<int> V) {
// General Graph A=3
vector<int> ans(M,-1);
vector<vector<pair<int,int>>> adj(N);
for(int i=0;i<M;i++){
adj[U[i]].emplace_back(V[i],i);
adj[V[i]].emplace_back(U[i],i);
}
vector<bool> visited(N);
queue<pair<int,int>> q;
q.emplace(0,0);
while(!q.empty()){
auto [idx,col] = q.front();q.pop();
if(visited[idx])continue;
visited[idx]=true;
for(auto&i:adj[idx]){
if(ans[i.second]==-1)ans[i.second]=col;
if(!visited[i.first])q.emplace(i.first,(col+1)%3);
}
}
return ans;
}
vector<int> strat2(int N, int M, int A, int B,
vector<int> U, std::vector<int> V) {
// Tree A=2,B=6
return {};
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,
vector<int> U, std::vector<int> V) {
if(A>=3)return strat1(N,M,A,B,U,V);
else return strat2(N,M,A,B,U,V);
}
#include <bits/stdc++.h>
using namespace std;
namespace {
int A, B;
int strat1(vector<int> y) {
// General Graph A=3
bool more0 = y[0]>0;
bool more1 = y[1]>0;
bool more2 = y[2]>0;
if(more0 and more1)return 0;
if(more1 and more2)return 1;
if(more2 and more0)return 2;
if(more0)return 0;
if(more1)return 1;
if(more2)return 2;
}
int strat2(vector<int> y) {
// Tree A=2,B=6
return -1;
}
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(vector<int> y) {
if(A>=3)return strat1(y);
else return strat2(y);
}
컴파일 시 표준 에러 (stderr) 메시지
Catherine.cpp: In function 'int {anonymous}::strat1(std::vector<int>)':
Catherine.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
18 | }
| ^
# | 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... |