Submission #145987

#TimeUsernameProblemLanguageResultExecution timeMemory
145987JovanK26Split the Attractions (IOI19_split)C++14
18 / 100
123 ms15524 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; vector< vector<int> > v(200001); bool vis[200001]; int sett[4]; int color; vector<int> temp(200001); void dfs(int start) { vis[start]=1; while(sett[color]==0) { color++; } temp[start]=color; sett[color]--; for(int i=0;i<v[start].size();i++) { if(!vis[v[start][i]]) { dfs(v[start][i]); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> rez(n); sett[1]=a; sett[2]=b; sett[3]=c; for(int i=0;i<p.size();i++) { v[p[i]].push_back(q[i]); v[q[i]].push_back(p[i]); } int ind=-1; for(int i=0;i<n;i++) { if(v[i].size()==1) { ind=i; break; } } if(ind==-1)ind=0; color=1; dfs(ind); for(int i=0;i<n;i++) { rez[i]=temp[i]; } return rez; }

Compilation message (stderr)

split.cpp: In function 'void dfs(int)':
split.cpp:18:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v[start].size();i++)
                 ~^~~~~~~~~~~~~~~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:32:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  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...