| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 369835 | MilosMilutinovic | Split the Attractions (IOI19_split) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "split.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int mxN=1e5;
vector<int> g[mxN], euler;
bool was[mxN];
void dfs(int u) {
assert(u>=0&&u<n);
was[u]=true;
euler.pb(u);
for(int i:g[u])
if(!was[i])
dfs(i);
}
vector<int> find_split(int n, int a, int b, int c, vector<int> u, vector<int> v) {
int m=(int)u.size();
for(int i=0; i<m; ++i)
g[u[i]].pb(v[i]), g[v[i]].pb(u[i]);
int root;
for(int i=0; i<n; ++i)
if((int)g[i].size()==1)
root=i;
dfs(root);
vector<int> ans(n);
for(int i:euler) {
if(a>0)
ans[i]=1, --a;
else
if(b>0)
ans[i]=2, --b;
else
ans[i]=3;
}
return ans;
}
/*int main() {
ios::sync_with_stdio(false);
cin.tie(0);
return 0;
}*/
