Submission #257271

# Submission time Handle Problem Language Result Execution time Memory
257271 2020-08-04T03:20:14 Z shrek12357 Carnival (CEOI14_carnival) C++14
0 / 100
8 ms 256 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
using namespace std;

int n;

int main() {
	cin >> n;
	vector<int> cur;
	cur.push_back(1);
	vector<int> place;
	vector<int> ans(n + 1);
	ans[1] = 1;
	for (int i = 1; i < n; i++) {
		cout << cur.size() + 1 << " ";
		for (int i = 0; i < cur.size(); i++) {
			cout << cur[i] << " ";
		}
		cout << i + 1 << endl;
		int temp;
		cin >> temp;
		if (temp == cur.size() + 1) {
			cur.push_back(i + 1);
			ans[i + 1] = i + 1;
		}
		else {
			place.push_back(i + 1);
		}
	}
	for (int i = 0; i < place.size(); i++) {
		int lo = 0;
		int hi = cur.size() - 1;
		while (lo < hi) {
			int mid = (lo + hi) / 2;
			cout << mid - lo + 2 << " ";
			for (int j = lo; j <= mid; j++) {
				cout << cur[j] << " ";
			}
			cout << place[i] << endl;
			int temp;
			cin >> temp;
			if (temp == mid - lo + 2) {
				lo = mid + 1;
			}
			else {
				hi = mid;
			}
		}
		ans[place[i]] = cur[lo];
	}
	cout << 0 << " ";
	for (int i = 1; i < ans.size(); i++) {
		cout << ans[i] << " ";
	}
	cout << endl;
  return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:24:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < cur.size(); i++) {
                   ~~^~~~~~~~~~~~
carnival.cpp:30:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (temp == cur.size() + 1) {
       ~~~~~^~~~~~~~~~~~~~~~~
carnival.cpp:38:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < place.size(); i++) {
                  ~~^~~~~~~~~~~~~~
carnival.cpp:60:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i < ans.size(); i++) {
                  ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 256 KB Integer 19 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 5 ms 256 KB Integer 11 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 8 ms 256 KB Integer 20 violates the range [1, 17]
3 Halted 0 ms 0 KB -