이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define inf 1000000009
#define MAXN 1000005
using namespace std;
typedef long long ll;
typedef pair < int , int > ii;
typedef set < int > si;
int n, k, sil[MAXN];
si :: iterator it;
int sor(int x, int y, int z){
if(x == y)return x;
if(z == y)return z;
if(x == z)return x;
return Query(x - 1, y - 1, z - 1) + 1;
}
void coz(si a, int x){
if(a.empty())
return;
si b;
int son = *a.begin();
b.insert(son);
a.erase(son);
k = 0;
// cout << x << " -> " << son << " ";
for(it = a.begin(); it != a.end(); it++){
// cout << *it << " ";
int y = sor(son, x, *it);
// cout << son << " " << x << " " << *it << " = " << y << endl;
if(y == x)
continue;
if(y == son){
sil[++k] = *it;
// it = a.erase(y);
b.insert(*it);
continue;
}
son = y;
sil[++k] = y;
sil[++k] = *it;
// it = a.erase(y);
b.insert(y);
b.insert(*it);
}
// cout << endl;
for(int i = 1; i <= k; i++)
a.erase(sil[i]);
Bridge(min(x - 1, son - 1), max(x - 1, son - 1));
// cout << x << " " << son << " " << b.size() << endl;
b.erase(son);
coz(b, son);
coz(a, x);
}
void Solve(int nn) {n = nn;
si a;
for(int i = 2; i <= n; i++)
a.insert(i);
coz(a, 1);
}
# | 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... |