답안 #905214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
905214 2024-01-12T18:21:30 Z MinaRagy06 Super Dango Maker (JOI22_dango3) C++17
0 / 100
508 ms 604 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 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 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 508 ms 556 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 604 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -