Submission #960708

# Submission time Handle Problem Language Result Execution time Memory
960708 2024-04-11T00:59:08 Z pcc Carnival (CEOI14_carnival) C++17
100 / 100
5 ms 952 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const int mxn = 155;
vector<int> v;
int ans[mxn];

int ask(vector<int> vvv){
	cout<<vvv.size()<<' ';
	for(auto &i:vvv)cout<<i<<' ';cout<<endl;
	int re;
	cin>>re;
	return re;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	v.push_back(1);
	ans[1] = 1;
	int pt = 2;
	for(int i = 2;i<=n;i++){
		v.push_back(i);
		if(ask(v) == v.size()){
			ans[i] = pt++;
			continue;
		}
		v.pop_back();
		int l = 0,r = v.size()-1;
		while(l != r){
			int mid = (l+r)>>1;
			vector<int> vv;
			for(int j = 0;j<=mid;j++){
				vv.push_back(v[j]);
			}
			vv.push_back(i);
			if(ask(vv) == vv.size())l = mid+1;
			else r = mid;
		}
		ans[i] = ans[v[l]];
	}
	cout<<0<<' ';for(int i = 1;i<=n;i++)cout<<ans[i]<<' ';cout<<endl;
	return 0;
}

Compilation message

carnival.cpp: In function 'int ask(std::vector<int>)':
carnival.cpp:18:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   18 |  for(auto &i:vvv)cout<<i<<' ';cout<<endl;
      |  ^~~
carnival.cpp:18:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   18 |  for(auto &i:vvv)cout<<i<<' ';cout<<endl;
      |                               ^~~~
carnival.cpp: In function 'int main()':
carnival.cpp:33:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   if(ask(v) == v.size()){
      |      ~~~~~~~^~~~~~~~~~~
carnival.cpp:46:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |    if(ask(vv) == vv.size())l = mid+1;
      |       ~~~~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 3 ms 456 KB Output is correct
4 Correct 2 ms 952 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 2 ms 600 KB Output is correct
4 Correct 2 ms 704 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 5 ms 452 KB Output is correct
4 Correct 2 ms 452 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 3 ms 456 KB Output is correct
4 Correct 2 ms 712 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 4 ms 452 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 4 ms 448 KB Output is correct
4 Correct 3 ms 456 KB Output is correct
5 Correct 4 ms 452 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 3 ms 704 KB Output is correct