Submission #826523

# Submission time Handle Problem Language Result Execution time Memory
826523 2023-08-15T16:21:32 Z MohamedAhmed04 Park (JOI17_park) C++14
10 / 100
137 ms 524 KB
#include <bits/stdc++.h>
#include "park.h"

using namespace std ;

const int MAX = 1400 + 10 ;

static int Place[MAX] ;

int n ;
int deg[MAX] ;
vector< vector<int> >adj(MAX) ;

bool cmp(int a , int b)
{
	for(int i = 0 ; i < n ; ++i)
		Place[i] = 1 ;
	Place[a] = 0 ;
	return (!Ask(0 , b , Place)) ; //if false then a is ancestor b
}

void Detect(int T, int N) 
{
	n = N ;
	if(n == 2)
	{
		Answer(0 , 1) ;
		return ;
	}
	vector<int>v ;
	for(int i = 1 ; i < n-1 ; ++i)
		v.push_back(i) ;
	sort(v.begin() , v.end() , cmp) ;
	Answer(0 , v[0]) ;
	for(int i = 0 ; i+1 < v.size() ; ++i)
		Answer(min(v[i] , v[i+1]) , max(v[i] , v[i+1])) ;
	Answer(v.back() , n-1) ;
	return ;
}

Compilation message

park.cpp: In function 'void Detect(int, int)':
park.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |  for(int i = 0 ; i+1 < v.size() ; ++i)
      |                  ~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 114 ms 468 KB Output is correct
2 Correct 78 ms 468 KB Output is correct
3 Correct 96 ms 516 KB Output is correct
4 Correct 134 ms 500 KB Output is correct
5 Correct 123 ms 524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 340 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 340 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 137 ms 468 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -