This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 vector < int > vi;
int n, k, sil[MAXN];
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(vi a, int x){
if(a.empty())
return;
vi b;
int son = a[0];
sil[0] = 1;
// b.pb(a[0]);
// cout << x << " -> " << son << " ";
for(int i = 1; i < a.size(); i++){
int it = a[i];
// cout << *it << " ";
int y = sor(son, x, it);
// cout << son << " " << x << " " << *it << " = " << y << endl;
if(y == x){
sil[i] = 0;
continue;
}
if(y == son){
sil[+i] = 1;
// b.pb(*it);
// b.insert(*it);
continue;
}
son = y;
sil[i] = 1;
// b.pb(*it);
}
// cout << endl;
vi of;
for(int i = 0; i < a.size(); i++)
if(!sil[i])
of.pb(a[i]);
else if(a[i] != son)
b.pb(a[i]);
Bridge(min(x - 1, son - 1), max(x - 1, son - 1));
// cout << x << " " << son << " " << b.size() << endl;
coz(b, son);
coz(of, x);
}
void Solve(int nn) {n = nn;
vi a;
for(int i = 2; i <= n; i++)
a.pb(i);
coz(a, 1);
}
Compilation message (stderr)
meetings.cpp: In function 'void coz(vi, int)':
meetings.cpp:35:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < a.size(); i++){
~~^~~~~~~~~~
meetings.cpp:56:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < a.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... |