#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl "\n"
#include "meetings.h"
mt19937 rng;
/*void Bridge(int u,int v){
cout<<u<<" "<<v<<endl;
}
int Query(int u,int v,int x){
cout<<u<<" "<<v<<" "<<x<<endl;
int x2;
cin>>x2;
return x2;
}*/
int par[2001];
int par4;
int n;
bool sort_by(int u,int v){
return Query(par4,u,v)==u;
}
void solve2(vector<int> v){
shuffle(v.begin(),v.end(),rng);
int st=v[0];
int en=v[1];
vector<int> sub[n];
set<int> now;
now.insert(st);
now.insert(en);
for(auto i:v){
if(i==st or i==en){
continue;
}
int x=Query(st,en,i);
now.insert(x);
if(i!=x){
sub[x].pb(i);
}
}
vector<int> ss;
for(auto j:now){
if(j!=st){
ss.pb(j);
}
}
par4=st;
sort(ss.begin(),ss.end(),sort_by);
for(int i=0;i<ss.size();i++){
if(i==0){
par[ss[i]]=par4;
}
else{
par[ss[i]]=ss[i-1];
}
}
for(auto j:now){
if(sub[j].size()>0){
sub[j].pb(j);
solve2(sub[j]);
}
}
}
void Solve(int nn){
n=nn;
rng= mt19937(chrono::steady_clock::now().time_since_epoch().count());
for(int i=0;i<n;i++){
par[i]=-1;
}
vector<int> kk;
for(int i=0;i<n;i++){
kk.pb(i);
}
solve2(kk);
for(int i=0;i<n;i++){
if(par[i]!=-1){
Bridge(min(par[i],i),max(par[i],i));
}
}
}
/*int main(){
Solve(5);
return 0;
}*/
Compilation message
meetings.cpp: In function 'void solve2(std::vector<int>)':
meetings.cpp:55:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<ss.size();i++){
~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [6] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [6] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [6] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
370 ms |
1400 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |