제출 #253718

#제출 시각아이디문제언어결과실행 시간메모리
253718ErkhemkhuuSplit the Attractions (IOI19_split)C++17
7 / 100
99 ms14708 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define F first #define S second const ll N = 100005; vector <int> path; bool vis[N]; vector <vector <int> > adj(N); void dfs(ll v) { vis[v] = true; path.pb(v); for(auto &u: adj[v]) { if(vis[u]) continue; dfs(u); } return; } vector <int> find_split(int n, int a, int b, int c, vector <int> p, vector <int> q) { int m = p.size(), i; for(i = 0; i < m; i++) { adj[p[i]].pb(q[i]); adj[q[i]].pb(p[i]); } dfs(0); vector <int> ans(n, 0); for(i = 0; i < a; i++) ans[path[i]] = 1; for(i = a; i < a + b; i++) ans[path[i]] = 2; for(i = a + b; i < n; i++) ans[path[i]] = 3; 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...