답안 #568693

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
568693 2022-05-26T05:27:07 Z errorgorn Super Dango Maker (JOI22_dango3) C++17
100 / 100
2574 ms 2824 KB
#include "dango3.h"

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ii pair<int,int>
#define fi first
#define se second
#define endl '\n'

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace {

int n,m;

void solve(set<signed> v){
	if (sz(v)==n){
		Answer(vector<signed>(all(v)));
		return;
	}
	
	int h=sz(v)/n/2;
	set<signed> l,r=v;
	
	for (auto it:v){
		r.erase(it);
		l.insert(it);
		
		if (sz(r)<n*h || Query(vector<signed>(all(r)))<h){
			r.insert(it);
			l.erase(it);
		}
	}
	
	solve(l);
	solve(r);
}

}

void Solve(signed N, signed M) {
	n=N,m=M;
	
	set<signed> v;
	rep(x,1,n*m+1) v.insert(x);
	
	solve(v);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 624 KB Output is correct
2 Correct 18 ms 604 KB Output is correct
3 Correct 26 ms 624 KB Output is correct
4 Correct 25 ms 620 KB Output is correct
5 Correct 15 ms 632 KB Output is correct
6 Correct 15 ms 508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 468 ms 1584 KB Output is correct
2 Correct 470 ms 1492 KB Output is correct
3 Correct 617 ms 1492 KB Output is correct
4 Correct 622 ms 1596 KB Output is correct
5 Correct 342 ms 1596 KB Output is correct
6 Correct 339 ms 1500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1861 ms 2788 KB Output is correct
2 Correct 1834 ms 2776 KB Output is correct
3 Correct 2574 ms 2824 KB Output is correct
4 Correct 2492 ms 2716 KB Output is correct
5 Correct 1378 ms 2820 KB Output is correct
6 Correct 1301 ms 2796 KB Output is correct