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 "grader.h"
#include<bits/stdc++.h>
using namespace std;
map<vector<int>,int>mp;
int que(int a,int b,int c){
vector<int>v={a,b,c};
sort(v.begin(),v.end());
if(mp.count(v))return mp[v];
return mp[v]=Query(v[0],v[1],v[2]);
}
using uint=unsigned int;
uint seed=239239239;
uint xrand(){
seed^=seed<<2;
seed^=seed>>7;
seed^=seed<<7;
return seed;
}
void solve(vector<int>v){
// for(auto&x:v)
// cerr<<x<<' ';
// cerr<<'\n';
if(v.size()<=1)return;
int kek=v[xrand()%v.size()];
int cur=v[0]==kek?v[1]:v[0];
vector<int>nw={cur};
for(int x:v){
if(x==cur||x==kek)continue;
int mem=que(x,cur,kek);
if(mem==kek)
;
else if(mem==cur)
nw.push_back(x);
else
nw.push_back(x),cur=mem;
}
Bridge(min(kek,cur),max(kek,cur));
solve(nw);
vector<int>other;
for(int x:v)
if(!count(nw.begin(),nw.end(),x))other.push_back(x);
solve(other);
}
void Solve(int n) {
mp.clear();
vector<int>ord(n);
iota(ord.begin(),ord.end(),0);
solve(ord);
}
# | 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... |