Submission #551085

# Submission time Handle Problem Language Result Execution time Memory
551085 2022-04-19T20:01:56 Z inksamurai Super Dango Maker (JOI22_dango3) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "dango3.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;
	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);
		}
		// print(c);
		// for(auto x:ids){
		// 	cout<<x<<" ";
		// }
		// print();
		if(j%n==n-1){
			pns.pb({});
			rep(k,n){
				// cout<<ids[0]<<" ";
				pns.back().pb(ids[0]);
				ids.erase(ids.begin());
			}
			// cout<<"\n";
		}
	}
	// print("ho",sz(pns));
	for(auto vc:pns){
		Answer(vc);
	}
}

signed main(){
_3xxEYjy;
	N=3;
	M=2;
	c={3,3,1,2,1,2};		
	Solve(N,M);
//
	return 0;
}

Compilation message

dango3.cpp: In function 'int main()':
dango3.cpp:71:2: error: 'N' was not declared in this scope
   71 |  N=3;
      |  ^
dango3.cpp:72:2: error: 'M' was not declared in this scope
   72 |  M=2;
      |  ^
dango3.cpp:73:2: error: 'c' was not declared in this scope
   73 |  c={3,3,1,2,1,2};
      |  ^