답안 #168140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168140 2019-12-11T13:38:22 Z dimash241 도서관 (JOI18_library) C++17
0 / 100
405 ms 556 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) {
	if (n > 200) exit(0);
	vector <int> m(n, 0);

	vector < int > ans;
		
	for(int p = 1; p < n; p ++) {
		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:68:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  assert(ans.size() == n);
         ~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 343 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 385 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 290 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 400 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 333 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 405 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 382 ms 552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 399 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 387 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 260 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 248 KB # of queries: 2
13 Incorrect 2 ms 376 KB Wrong Answer [8]
14 Runtime error 2 ms 532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 6 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 9 ms 536 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 343 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 385 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 290 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 400 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 333 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 405 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 382 ms 552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 399 ms 556 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 387 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 260 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 248 KB # of queries: 2
13 Incorrect 2 ms 376 KB Wrong Answer [8]
14 Runtime error 2 ms 532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 6 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 9 ms 536 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Incorrect 2 ms 276 KB Unexpected end of file - token expected
18 Incorrect 2 ms 376 KB Unexpected end of file - token expected
19 Incorrect 2 ms 376 KB Unexpected end of file - token expected
20 Incorrect 2 ms 376 KB Unexpected end of file - token expected
21 Incorrect 2 ms 248 KB Unexpected end of file - token expected
22 Incorrect 2 ms 248 KB Unexpected end of file - token expected
23 Incorrect 2 ms 252 KB Unexpected end of file - token expected
24 Incorrect 2 ms 376 KB Unexpected end of file - token expected
25 Incorrect 2 ms 376 KB Unexpected end of file - token expected
26 Incorrect 2 ms 252 KB Unexpected end of file - token expected
27 Incorrect 2 ms 248 KB Unexpected end of file - token expected
28 Incorrect 2 ms 376 KB Unexpected end of file - token expected
29 Incorrect 2 ms 376 KB Unexpected end of file - token expected
30 Incorrect 2 ms 248 KB Unexpected end of file - token expected