Submission #1009953

# Submission time Handle Problem Language Result Execution time Memory
1009953 2024-06-28T08:14:37 Z goduadzesaba Carnival (CEOI14_carnival) C++17
100 / 100
17 ms 1112 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=155;
int n,ans[N],y,mn; map<int,int> mp;
vector <int> v,t; set <int> s;
int ask(vector <int> a){
	cout<<(int)a.size()<<" ";
	for (int i:a) cout<<i<<" "; cout<<endl;
	int x; cin>>x; return x;
}
void solve(int l,int r,int x){
	int md=(l+r)/2;
	if (l==r){
		ans[x]=l; return;
	}
	v.clear();
	for (int i=l; i<=(l+r)/2; i++){
		v.push_back(i);
	}
	int y=ask(v); v.push_back(x);
	if (y==ask(v)){
		solve(l,md,x);
	}
	else solve(md+1,r,x);
}
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>n; mn=n+1;
	for (int i=1; i<=n; i++){
		ans[i]=i;
		if (!t.empty()) y=ask(t);
		t.push_back(i);
		if (i>1 && ask(t)==y) solve(1,i-1,i);
		s.insert(ans[i]);
	} cout<<"0 ";
	y=1;
	for (auto it:s){
		mp[it]=y; y++;
	}
	for (int i=1; i<=n; i++) cout<<mp[ans[i]]<<" ";
}

Compilation message

carnival.cpp: In function 'long long int ask(std::vector<long long int>)':
carnival.cpp:9:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    9 |  for (int i:a) cout<<i<<" "; cout<<endl;
      |  ^~~
carnival.cpp:9:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    9 |  for (int i:a) cout<<i<<" "; cout<<endl;
      |                              ^~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 11 ms 592 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 600 KB Output is correct
5 Correct 10 ms 488 KB Output is correct
6 Correct 16 ms 452 KB Output is correct
7 Correct 9 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 460 KB Output is correct
2 Correct 14 ms 456 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 3 ms 620 KB Output is correct
5 Correct 11 ms 600 KB Output is correct
6 Correct 10 ms 472 KB Output is correct
7 Correct 11 ms 732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 10 ms 600 KB Output is correct
3 Correct 8 ms 476 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 9 ms 472 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 12 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 600 KB Output is correct
2 Correct 11 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 1112 KB Output is correct
5 Correct 9 ms 720 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 344 KB Output is correct
2 Correct 17 ms 600 KB Output is correct
3 Correct 9 ms 600 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 7 ms 500 KB Output is correct
6 Correct 5 ms 600 KB Output is correct
7 Correct 5 ms 344 KB Output is correct