답안 #538495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
538495 2022-03-17T03:18:54 Z safaricola 도서관 (JOI18_library) C++17
19 / 100
259 ms 304 KB
#include <cstdio>
#include <vector>
using namespace std;
#include<bits/stdc++.h>
#include "library.h"
deque<int> ans;
void Solve(int N){
	vector<int> M(N);
	ans.push_back(0);
	M[0] = 1;
	for(int j=1; j<N; j++){
		for(int i=0; i<N; i++){
			if(M[i]!=1){
				M[i]=1;
				//for(int i=0; i<N; i++)cout<<M[i];
				//	cout<<endl;
				if(Query(M)==1){
					//cout<<"FOUND\n";
					M[ans[0]]=0;
					if(Query(M)==1){
						M[ans[0]]=1;
						ans.push_back(i);
					}else{
						M[ans[0]]=1;
						ans.push_front(i);
					}
					i=N;
					//for(auto it: ans) cout<<it<<" ";
					//	cout<<endl;
				}else{
					M[i]=0;
				}
			}
		}
	}
	assert(ans.size()==N);
	vector<int> res(N);
	for(int i = 0; i < N; i++) {
		res[i] = ans[i] + 1;
	}
	Answer(res);
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from library.cpp:4:
library.cpp: In function 'void Solve(int)':
library.cpp:36:19: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |  assert(ans.size()==N);
      |         ~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 284 KB # of queries: 8885
2 Correct 104 ms 280 KB # of queries: 8523
3 Correct 114 ms 208 KB # of queries: 8999
4 Correct 138 ms 208 KB # of queries: 9860
5 Correct 131 ms 280 KB # of queries: 10047
6 Correct 90 ms 304 KB # of queries: 9416
7 Correct 117 ms 280 KB # of queries: 9869
8 Correct 145 ms 280 KB # of queries: 9923
9 Correct 123 ms 296 KB # of queries: 9824
10 Correct 66 ms 208 KB # of queries: 4098
11 Correct 1 ms 208 KB # of queries: 0
12 Correct 0 ms 208 KB # of queries: 2
13 Correct 1 ms 208 KB # of queries: 4
14 Correct 1 ms 208 KB # of queries: 7
15 Correct 2 ms 208 KB # of queries: 89
16 Correct 3 ms 208 KB # of queries: 237
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 284 KB # of queries: 8885
2 Correct 104 ms 280 KB # of queries: 8523
3 Correct 114 ms 208 KB # of queries: 8999
4 Correct 138 ms 208 KB # of queries: 9860
5 Correct 131 ms 280 KB # of queries: 10047
6 Correct 90 ms 304 KB # of queries: 9416
7 Correct 117 ms 280 KB # of queries: 9869
8 Correct 145 ms 280 KB # of queries: 9923
9 Correct 123 ms 296 KB # of queries: 9824
10 Correct 66 ms 208 KB # of queries: 4098
11 Correct 1 ms 208 KB # of queries: 0
12 Correct 0 ms 208 KB # of queries: 2
13 Correct 1 ms 208 KB # of queries: 4
14 Correct 1 ms 208 KB # of queries: 7
15 Correct 2 ms 208 KB # of queries: 89
16 Correct 3 ms 208 KB # of queries: 237
17 Runtime error 259 ms 300 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -