Submission #202576

#TimeUsernameProblemLanguageResultExecution timeMemory
202576batmend_khSplit the Attractions (IOI19_split)C++14
7 / 100
107 ms15608 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; vector< vector<int> > gr; vector<int> val; void go(int cur, int par, int ind, int n); vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { gr.resize(n + 5); val.resize(n); int m = p.size(); for (int i = 0; i < m; i++) { int bg = p[i]; int en = q[i]; gr[en].push_back(bg); gr[bg].push_back(en); } int uzuur = 0; for (int i = 0; i < n; i++) { if (gr[i].size() == 1) uzuur = i; } go (uzuur, -1, 1, n); for (int i = 0; i < n; i++) { if (val[i] <= a) { val[i] = 1; continue; } if (val[i] <= a + b) { val[i] = 2; continue; } val[i] = 3; } return val; } void go(int cur, int par, int ind, int n) { val[cur] = ind; if (ind == n) return; for (int x : gr[cur]) { if (x == par) continue; go(x, cur, ind + 1, n); } }
#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...