답안 #960705

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
960705 2024-04-11T00:57:46 Z pcc 사육제 (CEOI14_carnival) C++17
0 / 100
3 ms 344 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;
	for(int i = 2;i<=n;i++){
		v.push_back(i);
		if(ask(v) == v.size()){
			ans[i] = i;
			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] = 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:32:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if(ask(v) == v.size()){
      |      ~~~~~~~^~~~~~~~~~~
carnival.cpp:45:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |    if(ask(vv) == vv.size())l = mid+1;
      |       ~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 344 KB Integer 19 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 2 ms 344 KB Integer 11 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 3 ms 344 KB Integer 20 violates the range [1, 17]
3 Halted 0 ms 0 KB -