답안 #627739

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
627739 2022-08-12T20:50:01 Z flappybird Super Dango Maker (JOI22_dango3) C++17
100 / 100
996 ms 732 KB
#include "dango3.h"

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

namespace {

	int N, M;

}  // namespace

void solve(vector<int>& v) {
	int sz = v.size();
	sz /= N;
	if (sz == 1) {
		Answer(v);
		return;
	}
	int lim = sz / 2;
	int i;
	vector<int> rem, sub;
	while (v.size()) {
		int t = v.back();
		int c = 0;
		v.pop_back();
		for (auto x : v) rem.push_back(x);
		if (Query(rem) < lim) c = 1;
		rem.resize(rem.size() - v.size());
		if (c) rem.push_back(t);
		else sub.push_back(t);
	}
	solve(rem);
	solve(sub);
}

void Solve(int _N, int _M) {
	N = _N;
	M = _M;
	int i;
	vector<int> all;
	for (i = 1; i <= N * M; i++) all.push_back(i);
	solve(all);
}

Compilation message

dango3.cpp: In function 'void solve(std::vector<int>&)':
dango3.cpp:20:6: warning: unused variable 'i' [-Wunused-variable]
   20 |  int i;
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 340 KB Output is correct
2 Correct 10 ms 300 KB Output is correct
3 Correct 11 ms 304 KB Output is correct
4 Correct 11 ms 340 KB Output is correct
5 Correct 10 ms 380 KB Output is correct
6 Correct 8 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 222 ms 500 KB Output is correct
2 Correct 208 ms 472 KB Output is correct
3 Correct 226 ms 488 KB Output is correct
4 Correct 240 ms 584 KB Output is correct
5 Correct 220 ms 468 KB Output is correct
6 Correct 227 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 885 ms 692 KB Output is correct
2 Correct 919 ms 708 KB Output is correct
3 Correct 968 ms 688 KB Output is correct
4 Correct 996 ms 732 KB Output is correct
5 Correct 877 ms 716 KB Output is correct
6 Correct 871 ms 612 KB Output is correct