Submission #954334

# Submission time Handle Problem Language Result Execution time Memory
954334 2024-03-27T15:59:03 Z LCJLY Super Dango Maker (JOI22_dango3) C++17
100 / 100
3987 ms 6836 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;

//code
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef pair<pii,pii>pi2;

//Query()  Answer()

//code
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef pair<pii,pii>pi2;

//Query()  Answer()

void Solve(int n, int m) {
	vector<int>arr[m];
	arr[0].push_back(1);
	
	vector<int>v;
	for(int x=n*m;x>=2;x--){
		v.push_back(x);
	}
	
	int ptr=1;
	unordered_set<int>se[m+10];
	se[0].insert(1);
	for(int x=0;x<=m;x++){
		se[x].insert(1);
	}
	
	for(int x=2;x<=n*m;x++){
		int l=0;
		int r=ptr;
		int mid;
		int best=r;
		
		while(l<=r){
			mid=(l+r)/2;
			vector<int>que;
			for(int i=1;i<=n*m;i++){
				if(i==x) continue;
				if(se[mid].find(i)!=se[mid].end()) continue;
				que.push_back(i);
			}
			int hold=Query(que);
			
			if(hold==m-mid-1){
				best=mid;
				r=mid-1;
			}
			else l=mid+1;
		}
		
		ptr=max(ptr,best+1);
		//show(ptr,ptr);
		arr[best].push_back(x);
		for(int y=best;y<=m;y++){
			se[y].insert(x);
		}
	}
	
	for(int x=0;x<m;x++){
		Answer(arr[x]);
	}
}
//code
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 604 KB Output is correct
2 Correct 23 ms 600 KB Output is correct
3 Correct 30 ms 604 KB Output is correct
4 Correct 30 ms 604 KB Output is correct
5 Correct 18 ms 604 KB Output is correct
6 Correct 19 ms 780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 720 ms 3776 KB Output is correct
2 Correct 708 ms 3648 KB Output is correct
3 Correct 1014 ms 3500 KB Output is correct
4 Correct 1006 ms 3440 KB Output is correct
5 Correct 615 ms 3268 KB Output is correct
6 Correct 605 ms 3672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2954 ms 6544 KB Output is correct
2 Correct 2999 ms 6664 KB Output is correct
3 Correct 3983 ms 6636 KB Output is correct
4 Correct 3987 ms 6836 KB Output is correct
5 Correct 2418 ms 6580 KB Output is correct
6 Correct 2348 ms 6508 KB Output is correct