제출 #891497

#제출 시각아이디문제언어결과실행 시간메모리
891497Sir_Ahmed_ImranSplit the Attractions (IOI19_split)C++17
0 / 100
631 ms1048576 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define ll long long #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define N 100000 vector<int> color; vector<int> e[N]; int s[N]; int A[N]; int B[N]; int C[N]; int y,z; void dfs(int v,int u,int a,int b,int c){ s[v]=1; for(auto& i:e[v]){ if(i==u) continue; dfs(i,v,a,b,c); s[v]+=s[i]; if(A[i]) A[v]=1; if(B[i]) B[v]=1; if(C[i]) C[v]=1; } if(s[v]==a) A[v]=1; if(s[v]==b) B[v]=1; if(s[v]==c) C[v]=1; } void Color(int v,int u,int a,int b,int c){ if(!z){ if(A[v] && s[v]==a+b) z=3; if(B[v] && s[v]==a+b) z=3; if(A[v] && s[v]==a+c) z=2; if(C[v] && s[v]==a+c) z=2; if(B[v] && s[v]==c+b) z=1; if(C[v] && s[v]==c+b) z=1; if(z) color[v]=4; } if(color[v]==4 && s[v]==a && z!=1 && !y){ color[v]=1; y=5-z; } if(color[v]==4 && s[v]==b && z!=2 && !y){ color[v]=2; y=4-z; } if(color[v]==4 && s[v]==c && z!=3 && !y){ color[v]=3; y=3-z; } for(auto& i:e[v]){ if(i==u) continue; color[i]=color[v]; Color(i,v,a,b,c); } } vector<int> find_split(int n,int a,int b,int c,vector<int> p,vector<int> q){ for(int i=y=z=0;i<p.size();i++){ e[p[i]].append(q[i]); e[q[i]].append(p[i]); } for(int i=0;i<n;i++) color.append(0); dfs(0,-1,a,b,c); Color(0,-1,a,b,c); for(int i=0;i<n;i++){ if(color[i]==0) color[i]=z; if(color[i]==4) color[i]=y; } return color; }

컴파일 시 표준 에러 (stderr) 메시지

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:62:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     for(int i=y=z=0;i<p.size();i++){
      |                     ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...