이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "split.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//#pragma GCC target("avx2")
//#pragma GCC optimization("unroll-loops")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
#define FOR(i,a) for (int i=0;i<(a);++i)
#define FORD(i,a) for (int i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (int i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (int i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define make_unique(v) v.erase(unique(all(v)),v.end())
using namespace std;
vector<int> ans,g[1000006];
int a,b;
bool col[1000006];
void dfsb(int v){
col[v]=true;
ans[v]=2;
b--;
if (!b)return;
trav(to,g[v]){
if (col[to])continue;
dfsb(to);
if (!b)return;
}
}
void dfsa(int v){
col[v]=true;
ans[v]=1;
a--;
if (!a)return;
trav(to,g[v]){
if (col[to])continue;
dfsa(to);
if (!a)return;
}
}
vector<int> find_split(int n, int A, int B, int C, vector<int> p, vector<int> q) {
fill(all(ans),3);
a=A;
b=B;
FOR(i,p.size()){
g[p[i]].ad(q[i]);
g[q[i]].ad(p[i]);
}
dfsb(0);
FOR(i,n){
if (!col[i]){
dfsa(i);
break;
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:14:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
14 | #define FOR(i,a) for (int i=0;i<(a);++i)
| ^
split.cpp:60:2: note: in expansion of macro 'FOR'
60 | FOR(i,p.size()){
| ^~~
# | 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... |