이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;
typedef pair <int, int> pii;
void f(int p, vector <int> &V)
{
vector <int> X;
vector <pii> Y;
int i, j, v, q;
swap(V[rand() % V.size()], V.back());
q = V.back(); V.pop_back();
for(int &t: V){
v = Query(p, q, t);
if(t == v) X.push_back(t);
else Y.emplace_back(v, t);
}
if(X.empty()) Bridge(p, q);
else{
sort(X.begin(), X.end(), [&](int &a, int &b){
if(a == b) return false;
return Query(p, a, b) == a;
});
Bridge(p, X[0]);
for(i=1; i<X.size(); i++){
Bridge(X[i - 1], X[i]);
}
Bridge(X.back(), q);
}
sort(Y.begin(), Y.end());
for(i=0; i<Y.size(); i=j){
V.clear();
for(j=i; j<Y.size() && Y[j].first == Y[i].first; j++){
V.push_back(Y[j].second);
}
f(Y[i].first, V);
}
}
void Solve(int n)
{
vector <int> V;
int i;
srand(time(0));
for(i=1; i<n; i++){
V.push_back(i);
}
f(0, V);
}
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'void f(int, std::vector<int>&)':
meetings.cpp:32:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i=1; i<X.size(); i++){
~^~~~~~~~~
meetings.cpp:40:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i=0; i<Y.size(); i=j){
~^~~~~~~~~
meetings.cpp:42:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j=i; j<Y.size() && Y[j].first == Y[i].first; j++){
~^~~~~~~~~
# | 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... |