답안 #1009874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1009874 2024-06-28T07:07:18 Z giorgi_pkhaladze 사육제 (CEOI14_carnival) C++17
100 / 100
16 ms 344 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
using namespace std;
int n,m,k,j,ans,a[200001],d[200001];
int solve(int l, int r){
	cout<<r-l+1<<" ";
	for(int i=l; i<=r; i++)cout<<i<<" "; cout<<endl;
	int p; cin>>p;
	return p;
}
int main() {
	cin>>n;
	int x=1; a[1]=x;
	for(k=2; k<=n; k++){
		if(solve(1,k)==solve(1,k-1)){
			int l=1; int r=k-1;
			ans=1;
			while(l<r){
				int md=(l+r+1)/2;
				if(solve(md,k)-1==solve(md,k-1))r=md-1;
				else l=md,ans=md;
			}
			a[k]=a[ans];
		}
		else x++,a[k]=x;
	}
	cout<<0<<" ";
	for(k=1; k<=n; k++)cout<<a[k]<<" "; cout<<endl;
}

Compilation message

carnival.cpp: In function 'int solve(int, int)':
carnival.cpp:9:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    9 |  for(int i=l; i<=r; i++)cout<<i<<" "; cout<<endl;
      |  ^~~
carnival.cpp:9:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    9 |  for(int i=l; i<=r; i++)cout<<i<<" "; cout<<endl;
      |                                       ^~~~
carnival.cpp: In function 'int main()':
carnival.cpp:30:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |  for(k=1; k<=n; k++)cout<<a[k]<<" "; cout<<endl;
      |  ^~~
carnival.cpp:30:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |  for(k=1; k<=n; k++)cout<<a[k]<<" "; cout<<endl;
      |                                      ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 10 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 11 ms 344 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 10 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 12 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 11 ms 344 KB Output is correct
6 Correct 10 ms 344 KB Output is correct
7 Correct 12 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 344 KB Output is correct
2 Correct 10 ms 344 KB Output is correct
3 Correct 15 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 14 ms 344 KB Output is correct
6 Correct 12 ms 344 KB Output is correct
7 Correct 11 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 344 KB Output is correct
2 Correct 16 ms 344 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 10 ms 344 KB Output is correct
7 Correct 9 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 340 KB Output is correct
2 Correct 12 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 8 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct