# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344064 | beksultan04 | Meetings (JOI19_meetings) | C++14 | 0 ms | 0 KiB |
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.cpp"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
using namespace std;
bool vis[2001],voobshe[2001];
void Solve(int N) {
int x = Query(0, 1, 2);
if (N == 3){
if (x == 0){
Bridge(0,1);
Bridge(0,2);
}
else if (x == 1){
Bridge(1,2);
Bridge(0,1);
}
else {
Bridge(0,2);
Bridge(1,2);
}
ret ;
}
int y = 1,i,j,cnt=0,k;
// if (x == 1)y = 0;
// vis[x]=1;
// vis[y]=1;
// while (1){
// for (i=0;i<N;++i){
// if (vis[i])continue;
// int s = Query(x,y,i);
// if (s != x && s != y && voobshe[s] == 0){
// y = s;
// for (j=0;j<N;++j)
// vis[j]=0;
// vis[x]=1;
// vis[y]=1;
// }
// }
// cout <<x<<" "<<y<<"\n";
// voobshe[x]=1;
// x = y;
// while (voobshe[y] || x == y){
// y++;
// y %= N;
// }
// vis[x]=1;
// vis[y]=1;
// OK
// }
map <pair<pii,int>,int > mp;
for (i=0;i<N;++i){
for (j=i+1;j<N;++j){
vis[i]=1;vis[j]=1;
bool f=1;
for (k=0;k<N;++k){
if (vis[k])continue;
int a = i,b = j,c = k;
/// our sort -_0
int s ;
if (a > b)swap(a,b);if (b > c)swap(b,c);if (a > b)swap(a,b);if (a > b)swap(a,b);if (b > c)swap(b,c);if (a > b)swap(a,b);
if (mp.count({{a,b},c})==0){
s = Query(i,j,k);
mp[{{a,b},c}] = s;
}
else s = mp[{{a,b},c}];
if (s != i && s != j){
f=0;
break;
}
vis[k]=1;
}
if (f){
Bridge(i, j);
}
for (k=0;k<N;++k)vis[k] = 0;
}
}
}