Submission #892629

# Submission time Handle Problem Language Result Execution time Memory
892629 2023-12-25T15:37:50 Z Minbaev Super Dango Maker (JOI22_dango3) C++17
100 / 100
347 ms 848 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
const int mod= 1e9 +7;
const int N=1e5*4;


void Solve(int n,int m){
	
	vector<int>v(n*m);
	
	iota(all(v),1);
	
	queue<pair<vector<int>,int>>q;
	
	q.push({v,m});
	
	while(!q.empty()){
		auto [g,sz] = q.front();
		q.pop();
		int pl = g.size();
		if(sz==1){
			Answer(g);
			continue;
		}
		vector<int>vs;
		for(int i = 0;i<pl;i++){
			vs.pb(g[0]);
			g.erase(g.begin());
			int x = Query(g);
			if(x<sz/2){
				g.pb(vs.back());
				vs.pop_back();
			}	
		}
		q.push({g,sz/2});
		q.push({vs,sz-sz/2});
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 348 KB Output is correct
2 Correct 54 ms 568 KB Output is correct
3 Correct 66 ms 564 KB Output is correct
4 Correct 66 ms 600 KB Output is correct
5 Correct 48 ms 560 KB Output is correct
6 Correct 48 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 205 ms 640 KB Output is correct
2 Correct 244 ms 668 KB Output is correct
3 Correct 281 ms 848 KB Output is correct
4 Correct 347 ms 624 KB Output is correct
5 Correct 187 ms 640 KB Output is correct
6 Correct 214 ms 624 KB Output is correct