답안 #772270

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
772270 2023-07-03T20:54:32 Z raysh07 Super Dango Maker (JOI22_dango3) C++17
100 / 100
1829 ms 696 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;

namespace {

int variable_example = 1;

}  // namespace

void Solve(int n, int m) {
  // std::vector<int> x(3);
  // x[0] = 1;
  // x[1] = 2;
  // x[2] = 3;
  // variable_example = Query(x);
  // for (int i = 0; i < M; i++) {
  //   std::vector<int> a(N);
  //   for (int j = 0; j < N; j++) {
  //     a[j] = N * i + j + 1;
  //   }
  //   Answer(a);
  // }

	vector <vector <int>> ans(m);
	vector <int> a(n * m);
	for (int i = 1; i <= n * m; i++){
		int l = 0, r = m - 1;

		while (l != r){
			int mid = (l + r)/2;

			for (auto &x : a) x = 1;

			for (int i = mid + 1; i < m; i++){
				for (auto x : ans[i]) a[x - 1] = 0;
			}
			a[i - 1] = 0;

			vector <int> qry;
			for (int i = 0; i < n * m; i++) if (a[i]) qry.push_back(i + 1);

			int get = Query(qry);
			
		//	cout << get << " " << mid << "\n";

			if (get >= mid + 1) l = mid + 1;
			else r = mid;
		}

		ans[l].push_back(i);
	//	cout << l << "\n";
	}

	for (int i = 0; i < m; i++) Answer(ans[i]);
}

Compilation message

dango3.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 304 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 1 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 340 KB Output is correct
2 Correct 12 ms 372 KB Output is correct
3 Correct 13 ms 384 KB Output is correct
4 Correct 12 ms 340 KB Output is correct
5 Correct 12 ms 376 KB Output is correct
6 Correct 10 ms 372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 360 ms 448 KB Output is correct
2 Correct 363 ms 468 KB Output is correct
3 Correct 432 ms 612 KB Output is correct
4 Correct 409 ms 476 KB Output is correct
5 Correct 325 ms 468 KB Output is correct
6 Correct 316 ms 580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1468 ms 604 KB Output is correct
2 Correct 1468 ms 608 KB Output is correct
3 Correct 1829 ms 696 KB Output is correct
4 Correct 1816 ms 616 KB Output is correct
5 Correct 1136 ms 588 KB Output is correct
6 Correct 1133 ms 580 KB Output is correct