Submission #301955

#TimeUsernameProblemLanguageResultExecution timeMemory
301955NicolaAbusaad2014Split the Attractions (IOI19_split)C++14
0 / 100
690 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<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 'void solve(long int, long int)':
split.cpp:15:19: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(long i=0;i<edges[n].size();i++){
      |                  ~^~~~~~~~~~~~~~~~
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...