이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "split.h"
//#include "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>>edges(100001);
vector<int>ANS;
bool VIS[100001];
int A=1,B=2,C=3,REMA,REMB;
void DFS0(int v){
if(VIS[v])
return;
VIS[v]=1;
if(REMB)
REMB--,ANS[v]=B;
else if(REMA)
REMA--,ANS[v]=A;
for(int i=0;i<edges[v].size();i++)
DFS0(edges[v][i]);
}
vector<int>find_split(int n,int a,int b,int c,vector<int>p,vector<int>q){
/*if(a>b&&a>c)
swap(a,c),swap(A,C);
else if(b>c&&b>a)
swap(b,c),swap(B,C);
if(a>b)
swap(a,b),swap(A,B);*/
REMB=b,REMA=a;
for(int i=0;i<p.size();i++)
edges[p[i]].push_back(q[i]),edges[q[i]].push_back(p[i]);
if(1){
ANS.resize(n);
for(int i=0;i<n;i++)
ANS[i]=3;
DFS0(0);
return ANS;
}
}
컴파일 시 표준 에러 (stderr) 메시지
split.cpp: In function 'void DFS0(int)':
split.cpp:17:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for(int i=0;i<edges[v].size();i++)
| ~^~~~~~~~~~~~~~~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:28:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for(int i=0;i<p.size();i++)
| ~^~~~~~~~~
# | 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... |