Submission #771998

# Submission time Handle Problem Language Result Execution time Memory
771998 2023-07-03T13:34:38 Z Mohammad_Parsa Library (JOI18_library) C++17
0 / 100
30 ms 208 KB
#include <cstdio>
#include <vector>
#include <iostream>
#include "library.h"
using namespace std;
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define mk make_pair
typedef long long ll;

const int N=1e3+7;
int vis[N];
vector<int>vec,a,b;

void Solve(int n){
	vector<int> m;
	vector<int> ans;
	int x=1;
	for(int i=1;i<=n;i++){
		m.clear();
		for(int j=1;j<=n;j++){
			int g=1;
			if(j==i)g=0;
			m.pb(g);
		}
		int y=Query(m);
		if(y==1){
			x=i;
			break;
		}
	}
	fill(vis,vis+N,0);
	ans.pb(x);vis[x]=1;
	for(int i=2;i<=n;i++){
		a.clear();
		for(int j=1;j<=n;j++){
			if(!vis[j])a.pb(j);
		}
		while(a.size()>1){
			b.clear();
			while(a.size()>b.size()){
				b.pb(a.back());
				a.pop_back();
			}
			m.clear();
			for(int j=1;j<=n;j++){
				int g=1;if(vis[j])g=0;
				m.pb(g);
			}
			for(auto j:b)m[j-1]=0;
			int val=Query(m);
			for(int j=1;j<=n;j++){
				if(vis[j])m[j-1]=1;
			}
			int val2=Query(m);
			if(val!=val2){
				swap(a,b);
			}
		}
		ans.pb(a[0]);
		vis[a[0]]=1;
	}
	Answer(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 27 ms 208 KB # of queries: 2399
2 Correct 29 ms 208 KB # of queries: 2445
3 Correct 25 ms 208 KB # of queries: 2652
4 Correct 25 ms 208 KB # of queries: 2593
5 Correct 25 ms 208 KB # of queries: 2518
6 Correct 30 ms 208 KB # of queries: 2535
7 Correct 29 ms 208 KB # of queries: 2546
8 Correct 28 ms 208 KB # of queries: 2406
9 Correct 30 ms 208 KB # of queries: 2536
10 Correct 18 ms 208 KB # of queries: 1486
11 Runtime error 0 ms 208 KB Execution killed with signal 13
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 208 KB # of queries: 2399
2 Correct 29 ms 208 KB # of queries: 2445
3 Correct 25 ms 208 KB # of queries: 2652
4 Correct 25 ms 208 KB # of queries: 2593
5 Correct 25 ms 208 KB # of queries: 2518
6 Correct 30 ms 208 KB # of queries: 2535
7 Correct 29 ms 208 KB # of queries: 2546
8 Correct 28 ms 208 KB # of queries: 2406
9 Correct 30 ms 208 KB # of queries: 2536
10 Correct 18 ms 208 KB # of queries: 1486
11 Runtime error 0 ms 208 KB Execution killed with signal 13
12 Halted 0 ms 0 KB -