이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |