Submission #168137

# Submission time Handle Problem Language Result Execution time Memory
168137 2019-12-11T13:30:21 Z dimash241 Library (JOI18_library) C++17
0 / 100
58 ms 404 KB
#include "library.h"

#include<bits/stdc++.h>

#define pb push_back 
using namespace std;

bool SEND = 1;
                                         
//int Query(const std::vector<int>& M);
//void Answer(const std::vector<int>& res);
int n, a[2222];

int ask (const std::vector < int > &m) {
	if (SEND) {
		return Query(m);
	}

	int l = -1, r = -1;
	for (int i = 1; i <= n; i ++) {
		if (m[a[i]-1]) {
			if (r == -1) l = i;
			r = i;
		}
	}
	
	if (r == -1) assert(0);
	return r - l;
}


void print (const std:: vector <int> &res) {
	if (SEND) {
		Answer(res);

	} else {
		for (auto x : res)
			cout << x << ' ';
		cout << '\n';
		exit(0);	
	}
}

void Solve(int n) {
	vector <int> m(n, 0);

	m[0] = 1;
	int mx = 0, p = 0;
	for(int i = 1; i < n; i ++) {
		m[i] = 1;
		int x;
		x = ask(m);
		if (x > mx) {
			mx = x;
			p = i;
		}
		m[i] = 0;
	}
	vector < pair < int, int > > res;
	m[0] = 0;

	for (int i = 0; i < n; i ++) {
		m[p] = 1;
		m[i] = 1;
		res.pb({ask(m), i+1});
		m[p] = 0;
		m[i] = 0;	
	} 

	sort(res.begin(), res.end());
	vector < int > ans;
	for (int i = 0; i < n; i ++)
		ans.pb(res[i].second);

	print(ans);
}

// B...a
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 380 KB Wrong Answer [8]
2 Incorrect 9 ms 380 KB Wrong Answer [8]
3 Incorrect 6 ms 316 KB Wrong Answer [8]
4 Incorrect 10 ms 248 KB Wrong Answer [8]
5 Incorrect 6 ms 404 KB Wrong Answer [8]
6 Incorrect 6 ms 404 KB Wrong Answer [8]
7 Incorrect 8 ms 376 KB Wrong Answer [8]
8 Incorrect 6 ms 404 KB Wrong Answer [8]
9 Incorrect 7 ms 376 KB Wrong Answer [8]
10 Incorrect 6 ms 376 KB Wrong Answer [8]
11 Correct 2 ms 376 KB # of queries: 1
12 Correct 2 ms 248 KB # of queries: 3
13 Incorrect 2 ms 248 KB Wrong Answer [8]
14 Incorrect 2 ms 248 KB Wrong Answer [8]
15 Incorrect 2 ms 376 KB Wrong Answer [8]
16 Incorrect 3 ms 376 KB Wrong Answer [8]
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 380 KB Wrong Answer [8]
2 Incorrect 9 ms 380 KB Wrong Answer [8]
3 Incorrect 6 ms 316 KB Wrong Answer [8]
4 Incorrect 10 ms 248 KB Wrong Answer [8]
5 Incorrect 6 ms 404 KB Wrong Answer [8]
6 Incorrect 6 ms 404 KB Wrong Answer [8]
7 Incorrect 8 ms 376 KB Wrong Answer [8]
8 Incorrect 6 ms 404 KB Wrong Answer [8]
9 Incorrect 7 ms 376 KB Wrong Answer [8]
10 Incorrect 6 ms 376 KB Wrong Answer [8]
11 Correct 2 ms 376 KB # of queries: 1
12 Correct 2 ms 248 KB # of queries: 3
13 Incorrect 2 ms 248 KB Wrong Answer [8]
14 Incorrect 2 ms 248 KB Wrong Answer [8]
15 Incorrect 2 ms 376 KB Wrong Answer [8]
16 Incorrect 3 ms 376 KB Wrong Answer [8]
17 Incorrect 51 ms 320 KB Wrong Answer [8]
18 Incorrect 54 ms 376 KB Wrong Answer [8]
19 Incorrect 41 ms 320 KB Wrong Answer [8]
20 Incorrect 50 ms 248 KB Wrong Answer [8]
21 Incorrect 50 ms 376 KB Wrong Answer [8]
22 Incorrect 51 ms 324 KB Wrong Answer [8]
23 Incorrect 41 ms 324 KB Wrong Answer [8]
24 Incorrect 17 ms 328 KB Wrong Answer [8]
25 Incorrect 39 ms 332 KB Wrong Answer [8]
26 Incorrect 43 ms 324 KB Wrong Answer [8]
27 Incorrect 22 ms 248 KB Wrong Answer [8]
28 Incorrect 40 ms 324 KB Wrong Answer [8]
29 Incorrect 56 ms 248 KB Wrong Answer [8]
30 Incorrect 58 ms 248 KB Wrong Answer [8]