This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
for(int i=0;i<n;i++)
DFS0(i);
return ANS;
}
}
Compilation message (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... |