Submission #96716

# Submission time Handle Problem Language Result Execution time Memory
96716 2019-02-11T12:19:14 Z Retro3014 Library (JOI18_library) C++17
0 / 100
586 ms 380 KB
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stdio.h>

#include "library.h"

using namespace std;

int q(const vector<int>& M){
	for(int i=0; i<M.size(); i++){
		if(M[i]!=0){
			return Query(M);
		}
	}return 0;
}

void Solve(int N){	
	vector<int> v(N);
	vector<int> ans(N);
	vector<bool> chk(N, 0);
	for(int i=0; i<N; i++){
		v[i] = true;
	}
	for(int i=0; i<N; i++){
		v[i] = false;
		int k = q(v);
		v[i] = true;
		if(k==1){
			ans[0] = i;
			chk[i] = true;
			break;
		}
	}
	for(int i=1; i<N; i++){
		int s = 0, e = N-1, m;
		while(s<e){
			m = (s+e)/2;
			int k1, k2;
			for(int j=0; j<N; j++){
				if(chk[j]){
					v[j] = false;
				}else if(s<=j && j<=m){
					v[j] = true;
				}else{
					v[j] = false;
				}
			}
			k1 = q(v);
			for(int j=0; j<N; j++){
				if(chk[j]){
					v[j] = true;
				}else if(s<=j && j<=m){
					v[j] = true;
				}else{
					v[j] = false;
				}
			}
			k2 = q(v);
			if(k1==k2){
				e = m;
			}else{
				s = m+1;
			}
		}
		ans[i] = s;
		chk[s] = true;
	}
	/*for(int i=0; i<N; i++){
		ans[i]++;
		cout<<ans[i]<<' '<<endl;
	}*/
	Answer(ans);
	return;
}

Compilation message

library.cpp: In function 'int q(const std::vector<int>&)':
library.cpp:12:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<M.size(); i++){
               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 248 KB Wrong Answer [5]
2 Incorrect 28 ms 248 KB Wrong Answer [5]
3 Incorrect 57 ms 376 KB Wrong Answer [5]
4 Incorrect 52 ms 248 KB Wrong Answer [5]
5 Incorrect 52 ms 248 KB Wrong Answer [5]
6 Incorrect 54 ms 380 KB Wrong Answer [5]
7 Incorrect 45 ms 248 KB Wrong Answer [5]
8 Incorrect 53 ms 376 KB Wrong Answer [5]
9 Incorrect 51 ms 248 KB Wrong Answer [5]
10 Incorrect 34 ms 380 KB Wrong Answer [5]
11 Incorrect 2 ms 252 KB Wrong Answer [5]
12 Incorrect 2 ms 376 KB Wrong Answer [5]
13 Incorrect 2 ms 248 KB Wrong Answer [5]
14 Incorrect 2 ms 252 KB Wrong Answer [5]
15 Incorrect 2 ms 248 KB Wrong Answer [5]
16 Incorrect 5 ms 248 KB Wrong Answer [5]
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 248 KB Wrong Answer [5]
2 Incorrect 28 ms 248 KB Wrong Answer [5]
3 Incorrect 57 ms 376 KB Wrong Answer [5]
4 Incorrect 52 ms 248 KB Wrong Answer [5]
5 Incorrect 52 ms 248 KB Wrong Answer [5]
6 Incorrect 54 ms 380 KB Wrong Answer [5]
7 Incorrect 45 ms 248 KB Wrong Answer [5]
8 Incorrect 53 ms 376 KB Wrong Answer [5]
9 Incorrect 51 ms 248 KB Wrong Answer [5]
10 Incorrect 34 ms 380 KB Wrong Answer [5]
11 Incorrect 2 ms 252 KB Wrong Answer [5]
12 Incorrect 2 ms 376 KB Wrong Answer [5]
13 Incorrect 2 ms 248 KB Wrong Answer [5]
14 Incorrect 2 ms 252 KB Wrong Answer [5]
15 Incorrect 2 ms 248 KB Wrong Answer [5]
16 Incorrect 5 ms 248 KB Wrong Answer [5]
17 Incorrect 545 ms 248 KB Wrong Answer [3]
18 Incorrect 503 ms 248 KB Wrong Answer [5]
19 Incorrect 536 ms 248 KB Wrong Answer [5]
20 Incorrect 507 ms 248 KB Wrong Answer [5]
21 Incorrect 453 ms 248 KB Wrong Answer [5]
22 Incorrect 586 ms 248 KB Wrong Answer [5]
23 Incorrect 583 ms 248 KB Wrong Answer [5]
24 Incorrect 160 ms 376 KB Wrong Answer [5]
25 Incorrect 496 ms 376 KB Wrong Answer [5]
26 Incorrect 445 ms 376 KB Wrong Answer [5]
27 Incorrect 116 ms 248 KB Wrong Answer [5]
28 Incorrect 415 ms 248 KB Wrong Answer [5]
29 Incorrect 395 ms 248 KB Wrong Answer [5]
30 Incorrect 415 ms 376 KB Wrong Answer [5]