Submission #568756

# Submission time Handle Problem Language Result Execution time Memory
568756 2022-05-26T07:24:51 Z jamielim Super Dango Maker (JOI22_dango3) C++17
100 / 100
1991 ms 1460 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
	
int n;
vector<int> v,q;

void solve(){
	if((int)v.size()==n){
		Answer(v);
		return;
	}
	int dangos=(int)v.size()/n;
	int d=(dangos+1)/2;
	set<int> s,t;
	for(int i:v)s.insert(i);
	for(int i:v){
		for(auto it=s.begin();it!=s.end();++it){
			if((*it)==i)continue;
			q.push_back(*it);
		}
		if(Query(q)>=d){
			t.insert(i);
			s.erase(i);
			if((int)s.size()==d*n)break;
		}
		q.clear();
	}
	q.clear();
	v.clear();
	for(int i:s)v.push_back(i);
	solve();
	v.clear();
	for(int i:t)v.push_back(i);
	solve();
	v.clear();
}

void Solve(int N, int M) {
	n=N;
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			v.push_back(M*i+j+1);
		}
	}
	solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 340 KB Output is correct
2 Correct 14 ms 448 KB Output is correct
3 Correct 17 ms 340 KB Output is correct
4 Correct 17 ms 340 KB Output is correct
5 Correct 9 ms 432 KB Output is correct
6 Correct 9 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 336 ms 884 KB Output is correct
2 Correct 317 ms 884 KB Output is correct
3 Correct 424 ms 876 KB Output is correct
4 Correct 476 ms 904 KB Output is correct
5 Correct 225 ms 900 KB Output is correct
6 Correct 230 ms 820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1310 ms 1420 KB Output is correct
2 Correct 1346 ms 1452 KB Output is correct
3 Correct 1988 ms 1412 KB Output is correct
4 Correct 1991 ms 1448 KB Output is correct
5 Correct 981 ms 1340 KB Output is correct
6 Correct 952 ms 1460 KB Output is correct