#include "icc.h"
#include <bits/stdc++.h>
using namespace std;
//int query(int a,int b,int* A,int *B);
//void setRoad(int a,int b);
int a[105];
int b[105];
int P[105];
bool hasEdge[105][105];
void run(int n) {
for(int i = 0; i < n; i ++){
P[i] = i+1;
}
for(int k = 1; k < n; k ++){
for(int i = 1; i <= n; i ++){
int cnt = 0;
for(int j = i+1; j <= n; j ++){
if(!hasEdge[j][i]){
b[cnt++] = j;
}
}
a[0] = i;
if(query(1, cnt, a, b)){
for(int j = i+1; j <= n; j ++){
b[0] = j;
if(!hasEdge[j][i]){
if(query(1, 1, a, b)){
hasEdge[j][i] = true;
hasEdge[i][j] = true;
//printf("%d %d\n", i, j);
setRoad(i, j);
}
}
}
break;
}
}
}
}
/*
vector<int>adjlist[100];
int n;
int current_a,current_b;
int calls=0;
int query(int a,int b,int* A,int *B){
calls++;
vector<bool>cities(n);
for(int i=0;i<b;i++){
cities[B[i]]=1;
}
for(int i=0;i<a;i++){
for(int y:adjlist[A[i]]){
if(cities[y])return 1;
}
}
return 0;
}
int roads = 0;
void setRoad(int a,int b){
roads++;
if(a>b)swap(a,b);
if(current_a>current_b)swap(current_a,current_b);
if(a!=current_a || b!=current_b){
printf("Wrong edge\n");
exit(0);
}
if(roads==n-1){
printf("OK\n");
printf("");
exit(0);
}
scanf("%d%d",¤t_a,¤t_b);
adjlist[current_a].push_back(current_b);
adjlist[current_b].push_back(current_a);
}
int main(){
scanf("%d",&n);
scanf("%d%d",¤t_a,¤t_b);
adjlist[current_a].push_back(current_b);
adjlist[current_b].push_back(current_a);
run(n);
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
512 KB |
Ok! 210 queries used. |
2 |
Incorrect |
7 ms |
512 KB |
Wrong road! |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
512 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
354 ms |
572 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
640 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
512 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
251 ms |
692 KB |
Number of queries more than 3250 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |