답안 #544547

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
544547 2022-04-02T09:33:16 Z benson1029 Super Dango Maker (JOI22_dango3) C++17
100 / 100
1325 ms 716 KB
#include "dango3.h"

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

namespace {

int n, m;
bool used[100005];
vector< vector<int> > ans;
vector<int> tmp;

}  // namespace

void solve(vector<int> a) {
	int size = a.size() / n;
	if(size==1) {
		ans.push_back(a);
		return;
	} else {
		vector<int> x, y;
		for(int i=0; i<a.size(); i++) used[i] = true;
		for(int i=0; i<a.size(); i++) {
			tmp.clear();
			for(int j=0; j<a.size(); j++) {
				if(j!=i && used[j]) tmp.push_back(a[j]);
			}
			int rv = Query(tmp);
			//cout << rv << " ";
			if(rv < size/2) {
				used[i] = true;
				x.push_back(a[i]);
			} else {
				used[i] = false;
				y.push_back(a[i]);
			}
		}
		//cout << "\n";
		solve(x);
		solve(y);
	}
}

void Solve(int N, int M) {
	srand(1024);
	
	n = N; m = M;
	
	vector<int> t; t.clear();
	
	for(int i=1; i<=N*M; i++) t.push_back(i);
	 
	solve(t);
	
	for(int i=0; i<M; i++) Answer(ans[i]); 
}

Compilation message

dango3.cpp: In function 'void solve(std::vector<int>)':
dango3.cpp:23:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for(int i=0; i<a.size(); i++) used[i] = true;
      |                ~^~~~~~~~~
dango3.cpp:24:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   for(int i=0; i<a.size(); i++) {
      |                ~^~~~~~~~~
dango3.cpp:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |    for(int j=0; j<a.size(); j++) {
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 384 KB Output is correct
2 Correct 12 ms 340 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Correct 13 ms 340 KB Output is correct
5 Correct 12 ms 376 KB Output is correct
6 Correct 13 ms 388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 303 ms 648 KB Output is correct
2 Correct 304 ms 476 KB Output is correct
3 Correct 347 ms 468 KB Output is correct
4 Correct 326 ms 468 KB Output is correct
5 Correct 295 ms 648 KB Output is correct
6 Correct 279 ms 524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1199 ms 712 KB Output is correct
2 Correct 1159 ms 716 KB Output is correct
3 Correct 1325 ms 632 KB Output is correct
4 Correct 1321 ms 704 KB Output is correct
5 Correct 1138 ms 712 KB Output is correct
6 Correct 1157 ms 708 KB Output is correct