Submission #301992

#TimeUsernameProblemLanguageResultExecution timeMemory
301992NicolaAbusaad2014Split the Attractions (IOI19_split)C++14
11 / 100
157 ms14584 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; vector<vector<long> >edges; long x=1; vector<int>ans; vector<bool>vis; long arr[3]; void solve(long n) { vis[n]=true; if(arr[x]==0){ x++; } arr[x]--; ans[n]=x+1; for(long i=0;i<(long)edges[n].size();i++){ if(!vis[edges[n][i]]){ solve(edges[n][i]); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { edges.resize(n); ans.resize(n); vis.resize(n); for(long i=0;i<(long)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+a; solve(0); for(long i=0;i<n;i++){ if(ans[i]==3){ ans[i]=1; break; } } return ans; }
#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...