답안 #298356

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
298356 2020-09-12T18:03:44 Z FlashGamezzz 사육제 (CEOI14_carnival) C++14
100 / 100
26 ms 512 KB
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cassert>
 
using namespace std;
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, count = 2, prefs[155], vals[155] = {};
	cin >> n;
	prefs[0] = 1;
	string s = "1";
	for (int i = 1; i < n; i++) {
		s += " " + to_string(i+1);
		cout << i+1 << " " << s << endl;
		cin >> prefs[i];
	}
	vals[0] = 1;
	for (int i = 1; i < n; i++) {
		if (prefs[i] == prefs[i-1]+1) {
			vals[i] = count;
			count++;
		}
	}
	vector<int> nums;
	for (int i = 0; i < n; i++) {
		if (vals[i] == 0) {
			for (int j = 1; j < nums.size(); j++){
              	int in;
				cout << 2 << " " << nums[j] << " " << (i+1) << endl;
				cin >> in;
				if (in == 1) {
					vals[i] = vals[nums[j]-1];
					break;
				}
			}
			if (vals[i] == 0) {
				vals[i] = vals[nums[0]-1];
			}
		} else {
			nums.push_back(i+1);
		}
	}
	cout << 0;
	for (int i = 0; i < n; i++) {
		cout << " " << vals[i];
	}
	cout << endl;
	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |    for (int j = 1; j < nums.size(); j++){
      |                    ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 12 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 12 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 15 ms 384 KB Output is correct
3 Correct 11 ms 384 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 10 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 8 ms 384 KB Output is correct
3 Correct 26 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 17 ms 384 KB Output is correct
7 Correct 17 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 15 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 13 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 12 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 17 ms 384 KB Output is correct
4 Correct 16 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 17 ms 384 KB Output is correct
7 Correct 7 ms 512 KB Output is correct