Submission #276332

#TimeUsernameProblemLanguageResultExecution timeMemory
276332Toirov_SadiSplit the Attractions (IOI19_split)C++17
18 / 100
139 ms14520 KiB
#include<bits/stdc++.h> #include "split.h" using namespace std; const int N = 1e5 + 7; int used[N]; vector<int> g[N]; vector<int> t; void dfs(int v){ used[v] = 1; t.push_back(v); for(auto to: g[v]){ if(used[to] == 0) dfs(to); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { for(int i = 0; i < (int)p.size(); i ++){ g[p[i]].push_back(q[i]); g[q[i]].push_back(p[i]); } int start = 0; for(int i = 0; i < n; i ++){ if((int)g[i].size() == 1) start = i; } dfs(start); vector<int> res(n); for(int i = 0; i < (int)t.size(); i ++){ if(a --> 0){ res[t[i]] = 1; } else if(b --> 0){ res[t[i]] = 2; } else if(c --> 0){ res[t[i]] = 3; } } 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...