이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long;
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define bas(x) #x << ": " << x
#define prarr(x, n) cout << #x << ": "; for (int qsd = 0; qsd < n; qsd++) cout << x[qsd] << " "; cout << endl;
#define prarrv(x) cout << #x << ": "; for (int qsd = 0; qsd < (int)x.size(); qsd++) cout << x[qsd] << " "; cout << endl;
#define inside sl<=l%&&r<=sr
#define outside sr<l||r<sl
void get(int root, vector<int>& arr){
//cout << "get(" << root << ")" << endl;
//prarrv(arr);
if (arr.size() == 0) return;
else if (arr.size() == 1){
//cout << "bridge(" << root << ", " << arr[0] << ")" << endl;
Bridge(min(root, arr[0]), max(root, arr[0]));
return;
}
int ch = arr[rand()%arr.size()];
vector<int> alt;
vector<int> ust;
vector<int> dig;
ust.pb(ch);
int en = ch;
for (int i = 0; i < arr.size(); i++){
//cout << "query(" << root << ", " << ch << ", " << arr[i] << ")" << endl;
if (ch == arr[i]) continue;
int ans = Query(root, ch, arr[i]);
if (ans == ch){
alt.pb(arr[i]);
} else if (ans == root){
dig.pb(arr[i]);
} else {
ust.pb(arr[i]);
if (arr[i] != en) en = Query(root, arr[i], en);
}
}
for (int i = 0; i < ust.size(); i++){
if (ust[i] == en){
int tmp = ust[ust.size()-1];
ust[ust.size()-1] = ust[i];
ust[i] = tmp;
break;
}
}
ust.pop_back();
Bridge(min(root, en), max(root, en));
get(root, dig);
get(en, ust);
get(ch, alt);
}
void Solve(int N) {
srand(time(0));
vector<int> arr(N-1);
for (int i = 1; i < N; i++) arr[i-1] = i;
get(0, arr);
}
컴파일 시 표준 에러 (stderr) 메시지
meetings.cpp: In function 'void get(int, std::vector<int>&)':
meetings.cpp:30:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < arr.size(); i++){
~~^~~~~~~~~~~~
meetings.cpp:44:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < ust.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... |