# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
772788 | Abrar_Al_Samit | Split the Attractions (IOI19_split) | C++17 | 47 ms | 10600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "split.h"
#include <bits/stdc++.h>
using namespace std;
const int nax = 1e5 + 3;
//subtask 2
vector<int>g[nax];
int m;
bool vis[nax];
int a, b, c;
vector<int>stk;
void dfs(int v) {
if(vis[v]) return;
stk.push_back(v);
vis[v] = 1;
if(stk.size()==min(b, c)) return;
for(int u : g[v]) {
dfs(u);
}
}
vector<int> find_split(int n, int A, int B, int C,
vector<int> p, vector<int> q) {
a = A, b = B, c = C;
m = p.size();
for(int i=0; i<m; ++i) {
g[p[i]].push_back(q[i]);
g[q[i]].push_back(p[i]);
}
dfs(0);
int cnt = 0;
vector<int>res(n, 0);
for(int x : stk) {
res[x] = b < c ? 2 : 3;
}
for(int i=0; i<n; ++i) if(res[i]==0) {
if(cnt<max(b, c)) {
++cnt;
res[i] = b < c ? 3 : 2;
} else {
res[i] = 1;
}
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |