이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "meetings.h"
#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;
int p[2009];
void calc(int root, vector<int> all){
if(all.size() <= 1) return;
for(auto it = all.begin(); it < all.end(); ++it)
if(*it == root){
all.erase(it);
break;
}
vector<vector<int>> groups;
for(auto u : all){
int put = 0;
for(auto &v : groups){
if(Query(v.front(), u, root) != root){
v.pb(u);
put = 1;
break;
}
}
if(put == 0){
groups.pb({u});
}
}
for(auto v : groups){
int nextroot = v[0];
for(int i = 1; i < v.size(); ++i)
if(v[i] != nextroot)
nextroot = Query(root, nextroot, v[i]);
p[nextroot] = root;
calc(nextroot, v);
}
}
void Solve(int n){
vector<int> all;
for(int i = 0; i < n; ++i)
all.pb(i);
calc(0, all);
for(int i = 1; i < n; ++i)
Bridge(min(i, p[i]), max(i, p[i]));
}
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'void calc(int, std::vector<int>)':
meetings.cpp:39:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < v.size(); ++i)
~~^~~~~~~~~~
# | 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... |