Submission #521010

#TimeUsernameProblemLanguageResultExecution timeMemory
521010lordlorincSplit the Attractions (IOI19_split)C++17
18 / 100
91 ms11316 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; vector<int> res; vector<vector<int> > graph; vector<bool> vis; int aa, bb, cc; void dfs(int pos){ // cout << pos << " " << a << " " << b << endl; bool ae = true; if (aa != 0) { res[pos] = 1; aa--; } else { res[pos] = 2; bb--; } vis[pos] = true; for (int x : graph[pos]){ if(vis[x]) continue; if (bb > 0) dfs(x); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { // cout << n << " " << a << " " << b << endl; res.assign(n, 3); int start = 0; graph.assign(n, vector<int>(0)); vis.assign(n, false); int m = p.size(); for (int i = 0; i < m; i++){ graph[p[i]].push_back(q[i]); graph[q[i]].push_back(p[i]); // cout << p[i] << " " << q[i] << endl; } for (int i = 0; i < n; i++){ if (graph[i].size() < 2) start = i; } aa = a, bb = b, cc = c; dfs(start); return res; } /* 6 5 2 2 2 0 1 1 2 2 3 3 4 4 5 */

Compilation message (stderr)

split.cpp: In function 'void dfs(int)':
split.cpp:14:10: warning: unused variable 'ae' [-Wunused-variable]
   14 |     bool ae = true;
      |          ^~
#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...