Submission #554619

# Submission time Handle Problem Language Result Execution time Memory
554619 2022-04-29T00:21:54 Z Arvin Super Dango Maker (JOI22_dango3) C++17
22 / 100
571 ms 576 KB
#include "dango3.h"
#include <bits/stdc++.h>

using namespace std;

//namespace {
//	int variable_example = 1;
//}  // namespace

void Solve(int n, int m) {
	int len = n*m;
	
	vector<int> v;
	for(int x=0;x<len;x++){
		v.push_back(x+1);
	}
	
	int cnt = m;
	while(cnt > 0){
		vector<int> w = v;
		int lst = 0;
		int left = 0, right = w.size()-1;
		while(left <= right){
			int mid = (left+right) >> 1;
			
			vector<int> z;
			for(int x=0;x<=mid;x++){
				z.push_back(w[x]);
			}
			
			if(Query(z) > 0){
				lst = mid;
				right = mid-1;
			} else {
				left = mid+1;
			}
		}
		
		vector<int> ans;
		int pos = 0;
		while(pos < lst){
			int bound = 0;
			int left = pos, right = lst;
			while(left <= right){
				int mid = (left+right) >> 1;
				
				vector<int> z = ans;
				for(int x=mid;x<=lst;x++){
					z.push_back(w[x]);
				}
				
				if(Query(z) > 0){
					bound = mid;
					left = mid+1;
				} else {
					right = mid-1;
				}
			}
			
			ans.push_back(w[bound]);
			pos = bound+1;
		}
		ans.push_back(w[lst]);
		
		v.clear();
		pos = 0;
		for(int x=0;x<w.size();x++){
			while(pos < ans.size() && ans[pos] < w[x]){
				pos++;
			}
			if(pos < ans.size() && ans[pos] == w[x]) continue;
			
			v.push_back(w[x]);
		}
		
		Answer(ans);
		cnt--;
	}
//	vector<int> x(3);
//	x[0] = 1;
//	x[1] = 2;
//	x[2] = 3;
//	variable_example = Query(x);
//	for (int i = 0; i < M; i++) {
//		std::vector<int> a(N);
//		for (int j = 0; j < N; j++) {
//		  a[j] = N * i + j + 1;
//		}
//		Answer(a);
//	}
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:67:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |   for(int x=0;x<w.size();x++){
      |               ~^~~~~~~~~
dango3.cpp:68:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |    while(pos < ans.size() && ans[pos] < w[x]){
      |          ~~~~^~~~~~~~~~~~
dango3.cpp:71:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |    if(pos < ans.size() && ans[pos] == w[x]) continue;
      |       ~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 304 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 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 340 KB Output is correct
2 Correct 9 ms 340 KB Output is correct
3 Correct 23 ms 404 KB Output is correct
4 Correct 23 ms 340 KB Output is correct
5 Correct 6 ms 340 KB Output is correct
6 Correct 6 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 101 ms 500 KB Output is correct
2 Correct 107 ms 488 KB Output is correct
3 Correct 570 ms 524 KB Output is correct
4 Correct 571 ms 516 KB Output is correct
5 Correct 56 ms 496 KB Output is correct
6 Correct 56 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 281 ms 576 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -