#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
typedef pair<int,int> pii;
const int MAXN = 60;
int N;
int other[MAXN];
bool marc[MAXN];
vector< int > adj[MAXN];
void DFS(int cur)
{
marc[ cur ] = true;
for(int i = 0 ; i < adj[cur].size() ; i++)
{
int viz = adj[cur][i];
if( marc[viz] ) continue;
DFS( viz );
}
}
void run(int n)
{
N = n;
for(int k = 1 ; k < N ; k++)
{
bool find = false;
int ansA = 0;
int ansB = 0;
for(int i = 1 ; i <= n && !find ; i++)
{
memset( marc , false , sizeof( marc ) );
DFS( i );
int cur[] = { i };
int p = 0;
for(int j = 1 ; j <= n ; j++)
if( !marc[j] ) other[ p++ ] = j;
if( query( 1 , p , cur , other ) == 1 )
{
ansA = i;
for(int j = 0 ; j < p && !find ; j++)
{
int V[] = { other[j] };
if( query( 1 , 1 , cur , V ) == 1 )
{
ansB = other[j];
find = true;
}
}
}
}
adj[ ansB ].push_back( ansA );
adj[ ansA ].push_back( ansB );
setRoad( ansA , ansB );
}
}
Compilation message
icc.cpp: In function 'void DFS(int)':
icc.cpp:21:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0 ; i < adj[cur].size() ; i++)
~~^~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
504 KB |
Ok! 301 queries used. |
2 |
Correct |
21 ms |
504 KB |
Ok! 293 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
254 ms |
632 KB |
Too many queries! 3605 out of 2500 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |