Submission #301961

#TimeUsernameProblemLanguageResultExecution timeMemory
301961NicolaAbusaad2014Split the Attractions (IOI19_split)C++14
0 / 100
692 ms1048580 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; vector<vector<long> >edges; long z=1,x=0; vector<int>ans; long arr[3]; void solve(long n,long p) { if(arr[x]==0){ x++; } arr[x]--; ans[n]=x+1; for(long i=0;i<(long)edges[n].size();i++){ if(edges[n][i]!=p){ solve(edges[n][i],n); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { edges.resize(n); ans.resize(n); for(long i=0;i<p.size();i++){ edges[p[i]].push_back(q[i]); edges[q[i]].push_back(p[i]); } arr[0]=a; arr[1]=b; arr[2]=c; solve(0,-1); return ans; }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:24:16: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(long 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...