Submission #154170

#TimeUsernameProblemLanguageResultExecution timeMemory
154170asifthegreatSplit the Attractions (IOI19_split)C++14
0 / 100
18 ms14712 KiB
#include <bits/stdc++.h> #include "split.h" using namespace std; const int N = 300000; vector<int>graph[N]; int mark[N]; bool vis[N]; int baki; void dfs(int at){ if(baki == 0)return; mark[at] = 2; baki--; vis[at] = true; for(auto i: graph[at]){ if(vis[i])continue; dfs(i); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res(n,0); // vector<int> something; // something.push_back(a); // something.push_back(c); // something.push_back(b); // sort(something.first(),something.second()); // a = something[0],b=something[1],c=something[2]; for(int i = 0; i < n;i++){ graph[p[i]].push_back(q[i]); graph[q[i]].push_back(p[i]); } baki = b; dfs(0); for(int i = 0; i < n;i++){ if(!vis[i]){ vis[i] = true; mark[i]= 1; break; } } for(int i = 0; i < n;i++){ if(!vis[i]){ vis[i] = true; mark[i]= 3; // break; } } for(int i = 0; i < n;i++){ res[i] = mark[i]; } return res; }
#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...