Submission #401479

# Submission time Handle Problem Language Result Execution time Memory
401479 2021-05-10T11:13:22 Z victoriad Library (JOI18_library) C++14
0 / 100
4 ms 200 KB
#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;

void Solve(int N)
{	vector<vector<int> >p(N);
	int f;
	for(int i=1;i<=N;i++){
		vector<int> M(N,0);
		M[i-1]=1;
		for(int k=i+1;k<=N;k++){
			M[k-1]=i;
			if(Query(M)==1){
				p[i-1].push_back(k-1);
				p[k-1].push_back(i-1);
			}
		}
		if(p[i-1].size()==1)f=i-1;
	}
	vector<bool>c(N,false);
	vector<int> res(N);
	res[0]=f+1;
	c[f]=true;
	for(int i=1;i<N;i++){
		for(int k=0;k<p[f].size();k++){
			if(!c[p[f][k]]){
				c[p[f][k]]=true;
				res[i]=p[f][k]+1;
				f=res[i]-1;
				break;
			}
		}
	}
	

	Answer(res);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:26:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for(int k=0;k<p[f].size();k++){
      |               ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 200 KB Expected integer, but "wa" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 200 KB Expected integer, but "wa" found
2 Halted 0 ms 0 KB -