# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293754 | egekabas | Split the Attractions (IOI19_split) | C++14 | 118 ms | 12664 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>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
using namespace std;
int lft;
vector<int> ans;
vector<int> g[100009];
void dfssp(int v){
if(lft <= 0) return;
--lft;
ans[v] = 2;
for(auto u : g[v])
if(ans[u] == 0)
dfssp(u);
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
for(int i = 0; i < p.size(); ++i){
g[p[i]].pb(q[i]);
g[q[i]].pb(p[i]);
}
ans.resize(n);
if(a == 1){
lft = b;
dfssp(0);
for(int i = 0; i < n; ++i)
if(ans[i] == 0){
ans[i] = 1;
break;
}
for(int i = 0; i < n; ++i)
if(ans[i] == 0)
ans[i] = 3;
return ans;
}
}
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... |