# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
772797 | Abrar_Al_Samit | Split the Attractions (IOI19_split) | C++17 | 77 ms | 12748 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> 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]);
}
vector<int>stk;
queue<int>qu;
qu.push(0);
while(stk.size()<b) {
int v = qu.front();
qu.pop();
if(vis[v]) continue;
vis[v] = 1;
stk.push_back(v);
for(int u : g[v]) if(!vis[u]) {
qu.push(u);
}
}
int cnt = 0;
vector<int>res(n, 0);
for(int x : stk) {
res[x] = 2;
}
for(int i=0; i<n; ++i) if(res[i]==0) {
if(cnt<c) {
++cnt;
res[i] = 3;
} 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... |