답안 #905217

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
905217 2024-01-12T18:23:54 Z MinaRagy06 Super Dango Maker (JOI22_dango3) C++17
100 / 100
2351 ms 1212 KB
#include <bits/stdc++.h>
#include "dango3.h"
#ifdef MINA
#include "grader.cpp"
#endif
using namespace std;
#define ll long long

void Solve(int n, int m) {
	vector<int> v[m];
	auto getmx = [&] (vector<int> &x) {
		sort(x.begin(), x.end());
		int ptr = 0;
		vector<int> y;
		for (int i = 1; i <= n * m; i++) {
			while (ptr < x.size() && x[ptr] < i) {
				ptr++;
			}
			if (ptr < x.size() && x[ptr] == i) continue;
			y.push_back(i);
		}
		return m - Query(y);
	};
	for (int i = 1; i <= n * m; i++) {
		int l = 0, r = m - 1;
		while (l <= r) {
			int md = ((l + r) >> 1);
			v[md].push_back(i);
			int mx = getmx(v[md]);
			v[md].pop_back();
			if (mx == 1) {
				r = md - 1;
			} else {
				l = md + 1;
			}
		}
		v[l].push_back(i);
	}
	for (auto i : v) {
		Answer(i);
	}
}

Compilation message

dango3.cpp: In lambda function:
dango3.cpp:16:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |    while (ptr < x.size() && x[ptr] < i) {
      |           ~~~~^~~~~~~~~~
dango3.cpp:19:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |    if (ptr < x.size() && x[ptr] == i) continue;
      |        ~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 348 KB Output is correct
2 Correct 17 ms 348 KB Output is correct
3 Correct 17 ms 348 KB Output is correct
4 Correct 18 ms 348 KB Output is correct
5 Correct 17 ms 348 KB Output is correct
6 Correct 16 ms 500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 506 ms 572 KB Output is correct
2 Correct 503 ms 580 KB Output is correct
3 Correct 563 ms 596 KB Output is correct
4 Correct 567 ms 600 KB Output is correct
5 Correct 512 ms 596 KB Output is correct
6 Correct 501 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2044 ms 908 KB Output is correct
2 Correct 2016 ms 1212 KB Output is correct
3 Correct 2285 ms 752 KB Output is correct
4 Correct 2351 ms 740 KB Output is correct
5 Correct 1996 ms 1172 KB Output is correct
6 Correct 1999 ms 672 KB Output is correct