제출 #723189

#제출 시각아이디문제언어결과실행 시간메모리
723189GrandTiger1729Split the Attractions (IOI19_split)C++17
11 / 100
115 ms15040 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q){ int m = p.size(); vector<vector<int>> g(n); for (int i = 0; i < m; i++){ int u = p[i], v = q[i]; g[u].push_back(v); g[v].push_back(u); } vector<bool> vis(n); vector<int> ans(n, 3); function<void(int)> dfs = [&](int u){ vis[u] = 1; if (b > 0){ ans[u] = 2; b--; } for (auto &v: g[u]){ if (vis[v]) continue; dfs(v); } }; dfs(0); for (int 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...