Submission #290579

#TimeUsernameProblemLanguageResultExecution timeMemory
290579Pichon5Split the Attractions (IOI19_split)C++17
0 / 100
75 ms8196 KiB
#include "split.h" #include <bits/stdc++.h> #define pb push_back using namespace std; vector<vector<int> >G; vector<int>res; int aux=0; int cc=1; void dfs(int nodo,int x,int padre){ if(aux==x){ return; } res[nodo]=cc; aux++; for(int i=0;i<G[nodo].size();i++){ if(G[nodo][i]!=padre){ dfs(G[nodo][i],x,nodo); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { G.assign(n,vector<int>()); for(int i=0;i<p.size();i++){ G[p[i]].pb(q[i]); G[q[i]].pb(p[i]); } res.assign(n,3); for(int i=0;i<n;i++){ if(G[i].size()==1 && cc==1){ dfs(i,a,-1); aux=0; cc++; continue; } if(G[i].size()==1 && cc==2){ dfs(i,b,-1); break; } } return res; }

Compilation message (stderr)

split.cpp: In function 'void dfs(int, int, int)':
split.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<G[nodo].size();i++){
      |                 ~^~~~~~~~~~~~~~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for(int i=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...