Submission #798000

# Submission time Handle Problem Language Result Execution time Memory
798000 2023-07-30T08:58:50 Z vjudge1 Library (JOI18_library) C++17
0 / 100
222 ms 412 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;

void Solve(int N){
	vector<int>v(N);
	vector<int>tmp[N];
	vector<bool>vis(N, 0);

	for(int i = 0; i < N; i++){
		if(i > 0) v[i - 1] = 0;
		v[i] = 1;
		v[N - 1] = 0;
		for(int j = i + 1; j < N; j++){
			if(j > i + 1) v[j - 1] = 0;
			v[j] = 1;
			if(Query(v) == 1){
				tmp[i].push_back(j);
				tmp[j].push_back(i);
			}
		}
	}

	int cur = -1;
	for(int i = 0; i < N; i++){
		if(tmp[i].size() == 1){
			cur = i;
			break;
		}
	}

	vector<int>res;

	while(res.size() < N){
		res.push_back(cur + 1);
		vis[cur] = true;
		for(auto &x: tmp[cur]){
			if(!vis[x]){
				vis[x] = true;
				cur = x;
				break;
			}
		}
	}

	Answer(res);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:34:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |  while(res.size() < N){
      |        ~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 140 ms 292 KB # of queries: 18336
2 Correct 191 ms 208 KB # of queries: 18145
3 Correct 169 ms 288 KB # of queries: 19900
4 Correct 200 ms 284 KB # of queries: 19900
5 Correct 222 ms 296 KB # of queries: 19900
6 Correct 194 ms 284 KB # of queries: 19900
7 Correct 176 ms 284 KB # of queries: 19900
8 Correct 151 ms 412 KB # of queries: 18528
9 Correct 181 ms 284 KB # of queries: 19701
10 Correct 74 ms 208 KB # of queries: 8256
11 Runtime error 1 ms 336 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 140 ms 292 KB # of queries: 18336
2 Correct 191 ms 208 KB # of queries: 18145
3 Correct 169 ms 288 KB # of queries: 19900
4 Correct 200 ms 284 KB # of queries: 19900
5 Correct 222 ms 296 KB # of queries: 19900
6 Correct 194 ms 284 KB # of queries: 19900
7 Correct 176 ms 284 KB # of queries: 19900
8 Correct 151 ms 412 KB # of queries: 18528
9 Correct 181 ms 284 KB # of queries: 19701
10 Correct 74 ms 208 KB # of queries: 8256
11 Runtime error 1 ms 336 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -