Submission #1009867

# Submission time Handle Problem Language Result Execution time Memory
1009867 2024-06-28T07:03:59 Z giorgi_pkhaladze Carnival (CEOI14_carnival) C++17
0 / 100
6 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;
			ans=0;
			while(l<=r){
				int md=(l+r)/2;
				if(solve(md,k)-1==solve(md,k-1))r=md-1;
				else l=md+1,ans=md;
			}
			a[k]=a[ans];
		}
		else a[k]=x,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;
      |                                      ^~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 6 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -