답안 #551441

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
551441 2022-04-20T17:30:27 Z inksamurai Super Dango Maker (JOI22_dango3) C++17
22 / 100
2421 ms 496 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(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(m-j/n,x,res);
			if(res==(m-1)){
				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,cnt[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);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 252 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 340 KB Output is correct
2 Correct 37 ms 340 KB Output is correct
3 Correct 41 ms 368 KB Output is correct
4 Correct 37 ms 304 KB Output is correct
5 Correct 34 ms 348 KB Output is correct
6 Correct 33 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 865 ms 420 KB Output is correct
2 Correct 933 ms 468 KB Output is correct
3 Correct 932 ms 472 KB Output is correct
4 Correct 996 ms 472 KB Output is correct
5 Correct 898 ms 448 KB Output is correct
6 Correct 927 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2421 ms 496 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -