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 <bits/stdc++.h>
#include "icc.h"
using namespace std;
/*int query(int a, int b, int x[], int y[]) {
cout<<x[0]<<" "<<y[0]<<"\n";
int answ;
cin>>answ;
return answ;
}
void setRoad(int x, int y) {
cout<<"Road: "<<x<<" "<<y<<"\n";
}*/
void run(int N) {
bool road[N+2][N+2];
memset(road, false, sizeof(road));
for(int ed=1;ed<N-1;ed++) {
bool found = false;
for(int fi=1;fi<=N;fi++) {
for(int si=fi+1;si<=N;si++) {
if(!road[fi][si] && !found) {
int a[] = {fi};
int b[] = {si};
bool temp = bool(query(1,1,a,b));
if(temp) {
road[fi][si] = road[si][fi] = true;
for(int i=1;i<=N;i++) {
for(int j=1;j<=N;j++) {
if((road[i][fi] && road[j][si]) || (road[j][fi] && road[i][si])) {
road[i][j] = road[j][i] = true;
}
}
}
found = true;
}
}
}
}
}
}
/*int main() {
run(4);
}*/
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |