답안 #42495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42495 2018-02-27T21:23:16 Z iletavcioski 사육제 (CEOI14_carnival) C++14
100 / 100
34 ms 2020 KB
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> v;
	v.push_back(1);
	vector<int> vkraj(n+1,0);
	vkraj[1]=1;
	for(int i=2;i<=n;i++)
	{
		int k=v.size();
		cout<<k+1<<endl;
		for(int j=0;j<v.size();j++)
		{
			cout<<v[j]<<endl;
		}
		cout<<i<<endl;
		int b;
		cin>>b;
		if(b>k)
		{
			v.push_back(i);
			vkraj[i]=v.size();
		}
		else
		{
			for(int j=0;j<v.size();j++)
			{
				cout<<2<<endl;
				cout<<v[j]<<endl;
				cout<<i<<endl;
				int b;
				cin>>b;
				if(b==1)
				{
					vkraj[i]=vkraj[v[j]];
					break;
				}
			}
		}
	}
	cout<<0<<endl;
	for(int i=1;i<=n;i++)
	{
		cout<<vkraj[i]<<endl;
	}
	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:16:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<v.size();j++)
                ^
carnival.cpp:30:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j=0;j<v.size();j++)
                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2020 KB Output is correct
2 Correct 14 ms 2020 KB Output is correct
3 Correct 15 ms 2020 KB Output is correct
4 Correct 0 ms 2020 KB Output is correct
5 Correct 6 ms 2020 KB Output is correct
6 Correct 12 ms 2020 KB Output is correct
7 Correct 4 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 2020 KB Output is correct
2 Correct 10 ms 2020 KB Output is correct
3 Correct 9 ms 2020 KB Output is correct
4 Correct 5 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 4 ms 2020 KB Output is correct
7 Correct 17 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2020 KB Output is correct
2 Correct 5 ms 2020 KB Output is correct
3 Correct 2 ms 2020 KB Output is correct
4 Correct 8 ms 2020 KB Output is correct
5 Correct 1 ms 2020 KB Output is correct
6 Correct 3 ms 2020 KB Output is correct
7 Correct 4 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 2020 KB Output is correct
2 Correct 3 ms 2020 KB Output is correct
3 Correct 34 ms 2020 KB Output is correct
4 Correct 10 ms 2020 KB Output is correct
5 Correct 6 ms 2020 KB Output is correct
6 Correct 4 ms 2020 KB Output is correct
7 Correct 11 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 3 ms 2020 KB Output is correct
4 Correct 2 ms 2020 KB Output is correct
5 Correct 2 ms 2020 KB Output is correct
6 Correct 2 ms 2020 KB Output is correct
7 Correct 10 ms 2020 KB Output is correct