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,s;
/// our sort -_0
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;
{
int mass[3];
mass[0]=a;
mass[1]=b;
mass[2]=s;
sort(mass,mass+3);
mp[{{mass[0],mass[1]},mass[2]}] = s;
}
{
int mass[3];
mass[0]=a;
mass[1]=s;
mass[2]=c;
sort(mass,mass+3);
mp[{{mass[0],mass[1]},mass[2]}] = s;
}
{
int mass[3];
mass[0]=s;
mass[1]=b;
mass[2]=c;
sort(mass,mass+3);
mp[{{mass[0],mass[1]},mass[2]}] = 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;
}
}
}
Compilation message (stderr)
meetings.cpp: In function 'void Solve(int)':
meetings.cpp:76:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
76 | 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);
| ^~
meetings.cpp:76:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
76 | 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);
| ^~
meetings.cpp:37:9: warning: unused variable 'y' [-Wunused-variable]
37 | int y = 1,i,j,cnt=0,k;
| ^
meetings.cpp:37:19: warning: unused variable 'cnt' [-Wunused-variable]
37 | int y = 1,i,j,cnt=0,k;
| ^~~
# | 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... |