Submission #168139

# Submission time Handle Problem Language Result Execution time Memory
168139 2019-12-11T13:35:56 Z dimash241 Library (JOI18_library) C++17
0 / 100
2000 ms 572 KB
#include "library.h"

#include<bits/stdc++.h>
#define F first
#define S second
#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);

	int mx = 0, p = 0;
	vector < int > ans;
		
	for(int j = 1; j < n; j ++) {
		m[j] = 1;
		vector < pair < int, int > > res;
		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());
		if (res.back().F == n - 1) {
			for (int i = 0; i < n; i ++)
				ans.pb(res[i].second);

	        break;
		}
	}
	assert(ans.size() == n);
	 

	print(ans);
}

// B...a

Compilation message

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from library.cpp:3:
library.cpp: In function 'void Solve(int)':
library.cpp:69:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  assert(ans.size() == n);
         ~~~~~~~~~~~^~~~
library.cpp:48:6: warning: unused variable 'mx' [-Wunused-variable]
  int mx = 0, p = 0;
      ^~
# Verdict Execution time Memory Grader output
1 Runtime error 361 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 409 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 397 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 339 ms 448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 347 ms 572 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 404 ms 448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 399 ms 456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 358 ms 572 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 351 ms 448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 242 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 376 KB # of queries: 2
13 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 524 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 14 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 361 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 409 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 397 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 339 ms 448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 347 ms 572 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 404 ms 448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 399 ms 456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 358 ms 572 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 351 ms 448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 242 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 376 KB # of queries: 2
13 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 524 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 14 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Execution timed out 3032 ms 248 KB Time limit exceeded
18 Execution timed out 3064 ms 324 KB Time limit exceeded
19 Execution timed out 3073 ms 248 KB Time limit exceeded
20 Execution timed out 3062 ms 376 KB Time limit exceeded
21 Execution timed out 3050 ms 504 KB Time limit exceeded
22 Execution timed out 3046 ms 320 KB Time limit exceeded
23 Execution timed out 3023 ms 296 KB Time limit exceeded
24 Runtime error 1783 ms 468 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Execution timed out 3093 ms 376 KB Time limit exceeded
26 Execution timed out 3026 ms 412 KB Time limit exceeded
27 Runtime error 1756 ms 456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Execution timed out 3050 ms 252 KB Time limit exceeded
29 Execution timed out 3031 ms 324 KB Time limit exceeded
30 Execution timed out 3038 ms 248 KB Time limit exceeded