답안 #951696

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951696 2024-03-22T10:58:47 Z Darren0724 Super Dango Maker (JOI22_dango3) C++17
100 / 100
195 ms 816 KB
#include "dango3.h"

#include <bits/stdc++.h>
using namespace std;
const int N=10005;
void Solve(int n, int m) {
	vector<int> vis(N);
	for (int i = 0; i < m; i++) {
    	vector<int> a;
		for(int j=1;j<=n*m;j++){
			if(!vis[j]){
				a.push_back(j);
			}
		}
		shuffle(a.begin(),a.end(),mt19937(time(0)));
		int sz=a.size();
		int l=0,r=sz;
		while(r-l>1){
			int m=(l+r)>>1;
			if(Query(vector(a.begin(),a.begin()+m))>=1){
				r=m;
			}
			else{
				l=m;
			}
		}
		vector<int> t(sz);
		for(int j=0;j<r;j++){
			t[j]=1;
		}
		for(int j=0;j<r;j++){
			t[j]=0;
			vector<int> v;
			for(int k=0;k<r;k++){
				if(t[k]){
					v.push_back(a[k]);
				}
			}
			if(Query(v)==0){
				t[j]=1;
			}
		}
		vector<int> v;
		for(int k=0;k<r;k++){
			if(t[k]){
				v.push_back(a[k]);
				vis[a[k]]=1;
			}
		}
		Answer(v);
  	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 3 ms 548 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 604 KB Output is correct
2 Correct 52 ms 600 KB Output is correct
3 Correct 47 ms 600 KB Output is correct
4 Correct 46 ms 604 KB Output is correct
5 Correct 47 ms 604 KB Output is correct
6 Correct 53 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 192 ms 816 KB Output is correct
2 Correct 192 ms 660 KB Output is correct
3 Correct 169 ms 688 KB Output is correct
4 Correct 181 ms 656 KB Output is correct
5 Correct 193 ms 668 KB Output is correct
6 Correct 195 ms 656 KB Output is correct