답안 #1020655

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1020655 2024-07-12T08:06:50 Z Unforgettablepl Super Dango Maker (JOI22_dango3) C++17
22 / 100
435 ms 604 KB
#include "dango3.h"

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

namespace {

int SQRT = 5;

}  // namespace

void Solve(int N, int M) {
	vector<int> idxes(N*M);iota(idxes.begin(),idxes.end(),1);
	// shuffle(idxes.begin(),idxes.end(),mt19937(random_device()()));
	idxes.insert(idxes.begin(),0);
	for(int round=0;round<M-1;round++){
		vector<int> ans;
		SQRT = sqrt(M-round);
		for(int included=N*(M-round);included;included-=SQRT){
			vector<int> query;
			for(int i=1;i<=(included-SQRT);i++)query.emplace_back(idxes[i]);
			int q = 0;
			if(!query.empty()){
				for(int&i:ans)query.emplace_back(i);
				q = Query(query);
			}
			if(q>=1)continue;
			for(int inc=included;inc>included-SQRT;inc--){
				vector<int> query;
				for(int i=1;i<inc;i++)query.emplace_back(idxes[i]);
				int q = 0;
				if(!query.empty()){
					for(int&i:ans)query.emplace_back(i);
					q = Query(query);
				}
				if(q>=1)continue;
				ans.emplace_back(idxes[inc]);
				idxes.erase(idxes.begin()+inc);
				if(ans.size()==N)break;
			}
			if(ans.size()==N)break;	
		}
		Answer(ans);
	}
	idxes.erase(idxes.begin());
	Answer(idxes);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:39:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |     if(ans.size()==N)break;
      |        ~~~~~~~~~~^~~
dango3.cpp:41:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |    if(ans.size()==N)break;
      |       ~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 388 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 520 KB Output is correct
2 Correct 7 ms 348 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 116 ms 576 KB Output is correct
2 Correct 120 ms 344 KB Output is correct
3 Correct 174 ms 600 KB Output is correct
4 Correct 172 ms 604 KB Output is correct
5 Correct 95 ms 344 KB Output is correct
6 Correct 95 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 435 ms 600 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -