답안 #401479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
401479 2021-05-10T11:13:22 Z victoriad 도서관 (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++){
      |               ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 200 KB Expected integer, but "wa" found
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 200 KB Expected integer, but "wa" found
2 Halted 0 ms 0 KB -