이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "split.h"
#include <bits/stdc++.h>
using namespace std;
template<class T, class U>
void ckmin(T &a, U b)
{
if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
if (a < b) a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define MAXN 100013
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
int N, A, B, C;
vi edge[MAXN];
vi ans;
vi find_split(int n, int a, int b, int c, vector<int> p, vector<int> q)
{
N = n; A = a; B = b; C = c; ans.resize(N);
FOR(i, 0, SZ(p))
{
int u = p[i], v = q[i];
edge[u].PB(v);
edge[v].PB(u);
}
FOR(i, 0, N) ans[i] = -1;
// cerr << "HUH\n";
q.clear(); q.PB(0); b = 0;
while(!q.empty())
{
int u = q.back(); q.pop_back();
ans[u] = 2; b++;
// cerr << "MARK " << u << endl;
if (b == B) break;
for (int v : edge[u])
{
if (ans[v] == -1)
{
// cerr << u << " -> " << v << endl;
ans[v] = -2;
q.PB(v);
}
}
}
FOR(i, 0, N)
{
if (ans[i] != 2) ans[i] = 3;
}
FOR(i, 0, N)
{
if (ans[i] == 3)
{
ans[i] = 1;
break;
}
}
return ans;
}
# | 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... |