답안 #589654

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
589654 2022-07-05T05:17:05 Z Tekor Super Dango Maker (JOI22_dango3) C++17
7 / 100
819 ms 488 KB
#include "dango3.h"

#include <vector>

namespace {

int variable_example = 1;

}  // namespace
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int K = 1e4 + 10;
bool ban[K];
vector <int> dob;
bool check(int l,int r,int n) {
	vector <int> zap;
	for(int i = l;i <= r;i++) {
		if(ban[i])continue;
		zap.pb(i);
	}
	for(auto to : dob)zap.pb(to);
	if(zap.size() < n)return 0;
//	cout <<"? ";
//	for(auto to : zap) {
//		cout << to << " ";
//	}
//	cout << " from ";
//	for(auto to : dob) {
//		cout << to << " ";
//	}
//	cout << endl;
	return (Query(zap) >= 1);
}
/*
3 2
3 3 1 2 1 2
*/
void Solve(int n,int m) {
	for(int i = 1;i <= n * m;i++)ban[i] = 0;
	for(int it = 1;it <= m;it++) {
		int fir = -1;
		for(int l = 1;l <= n * m;l++) {
			if(!ban[l]) {
				fir = l;
				break;
			}
		}
		dob.clear();
		dob.pb(fir);
		ban[fir] = 1;
		int last = fir;
		for(int i = 2;i <= n;i++) {
			int l = last + 1,r = n * m,ans = n * m + 1;
			while(l <= r) {
				int mid = (l + r) / 2;
				if(!check(mid,n * m,n)) {
					ans = mid;
					r = mid - 1;
				}else {
					l = mid + 1;
				}
			}
			dob.pb(ans - 1);
			ban[ans - 1] = 1;
			last = ans - 1;
		}
		Answer(dob);
	}
}

Compilation message

dango3.cpp: In function 'bool check(int, int, int)':
dango3.cpp:23:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |  if(zap.size() < n)return 0;
      |     ~~~~~~~~~~~^~~
dango3.cpp: At global scope:
dango3.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 372 KB Output is correct
2 Correct 21 ms 364 KB Output is correct
3 Correct 30 ms 340 KB Output is correct
4 Correct 32 ms 340 KB Output is correct
5 Correct 16 ms 372 KB Output is correct
6 Correct 16 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 485 ms 424 KB Output is correct
2 Correct 505 ms 424 KB Output is correct
3 Incorrect 757 ms 444 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 819 ms 488 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -