Submission #551436

# Submission time Handle Problem Language Result Execution time Memory
551436 2022-04-20T17:23:35 Z inksamurai Super Dango Maker (JOI22_dango3) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rng(i,x,n) for(int i=x;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3xxEYjy ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vector<int>;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}
// e

void Solve(int n,int m){
	vi ids;
	rep(i,n*m){
		ids.pb(i+1);
	}
	vec(vi) pns(m);
	rep(j,n*m){
		int l=0,r=sz(ids)-1,c=-1;
		while(l<=r){
			int mid=(l+r)/2;
			vi ask;
			rep(i,mid+1){
				ask.pb(ids[i]);
			}
			int res=Query(ask);
			if(res>0){
				c=mid;
				r=mid-1;
			}else{
				l=mid+1;
			}
		}
		{
			int x=ids[c];
			ids.erase(ids.begin()+c);
			ids.insert(ids.begin(),x);
		}
		if(j%n==n-1){
			rep(k,n){
				pns[0].pb(ids[0]);
				ids.erase(ids.begin());
			}
			break;
		}
	}
	vi cnt(n+1,1);
	rng(j,n,n*m){
		int l=0,r=n-1,c=-1;
		while(l<=r){
			int mid=(l+r)/2;
			rep(k,mid+1){
				ids.pb(pns[0][k]);
			}
			int x=ids[j-n];
			ids.erase(ids.begin()+j-n);
			int res=Query(ids);
			// print(j-n,x,res);
			if(res==(m-j/n)){
				c=mid;
				r=mid-1;
			}else{
				l=mid+1;
			}
			ids.insert(ids.begin()+j-n,x);
			rep(k,mid+1){
				ids.pop_back();
			}
		}
		// print(c);
		// for(auto x:ids){
		// 	cout<<x<<" ";
		// }
		// print();
		// break;
		pns[cnt[c]].pb(ids[j-n]);
		cnt[c]+=1;
	}
	// print("ho",sz(pns));
	for(auto vc:pns){
		Answer(vc);
	}
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:34:12: error: 'Query' was not declared in this scope
   34 |    int res=Query(ask);
      |            ^~~~~
dango3.cpp:65:12: error: 'Query' was not declared in this scope
   65 |    int res=Query(ids);
      |            ^~~~~
dango3.cpp:89:3: error: 'Answer' was not declared in this scope
   89 |   Answer(vc);
      |   ^~~~~~