Submission #554682

# Submission time Handle Problem Language Result Execution time Memory
554682 2022-04-29T07:19:08 Z Arvin Super Dango Maker (JOI22_dango3) C++17
22 / 100
840 ms 273964 KB
#include "dango3.h"
#include <bits/stdc++.h>

using namespace std;

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

map<vector<int>, int> mp;

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);
	}
	
	auto ask = [&](vector<int> &v) -> int {
		if(mp.count(v)) return mp[v];
		return mp[v] = Query(v);
	};
	
	int cnt = m;
	while(cnt > 0){
		vector<int> w = v;
		vector<int> ans;
		int pos = 0;
		while(pos < w.size() && ans.size()+1 < n){
			int bound = 0;
			int left = pos, right = w.size()-1;
			while(left <= right){
				int mid = (left+right) >> 1;
				
				vector<int> z = ans;
				for(int x=mid;x<w.size();x++){
					z.push_back(w[x]);
				}
				
				if(ask(z) > 0){
					bound = mid;
					left = mid+1;
				} else {
					right = mid-1;
				}
			}
			
			ans.push_back(w[bound]);
			pos = bound+1;
		}
		ans.push_back(w.back());
		
		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--;
	}
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:30:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   while(pos < w.size() && ans.size()+1 < n){
      |         ~~~~^~~~~~~~~~
dango3.cpp:30:40: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |   while(pos < w.size() && ans.size()+1 < n){
      |                           ~~~~~~~~~~~~~^~~
dango3.cpp:37:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int x=mid;x<w.size();x++){
      |                   ~^~~~~~~~~
dango3.cpp:56:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |   for(int x=0;x<w.size();x++){
      |               ~^~~~~~~~~
dango3.cpp:57:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |    while(pos < ans.size() && ans[pos] < w[x]){
      |          ~~~~^~~~~~~~~~~~
dango3.cpp:60:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |    if(pos < ans.size() && ans[pos] == w[x]) continue;
      |       ~~~~^~~~~~~~~~~~
# Verdict Execution time Memory 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 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 3924 KB Output is correct
2 Correct 19 ms 3820 KB Output is correct
3 Correct 43 ms 10656 KB Output is correct
4 Correct 42 ms 10476 KB Output is correct
5 Correct 13 ms 2316 KB Output is correct
6 Correct 14 ms 2224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 267 ms 56292 KB Output is correct
2 Correct 265 ms 56300 KB Output is correct
3 Correct 840 ms 273832 KB Output is correct
4 Correct 839 ms 273964 KB Output is correct
5 Correct 148 ms 22468 KB Output is correct
6 Correct 156 ms 22548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 786 ms 172004 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -