Submission #869641

# Submission time Handle Problem Language Result Execution time Memory
869641 2023-11-05T07:14:58 Z willychan Super Dango Maker (JOI22_dango3) C++17
2 / 100
739 ms 1048576 KB
#include "dango3.h"

#include <vector>
#include<random>
#include<algorithm>
#include<iostream>
#include<cassert>
using namespace std;
namespace {

int variable_example = 1;
int n,m;
}  // namespace

void ans(vector<int> pos){
	if(pos.size()==n){Answer(pos);return;}
	random_shuffle(pos.begin(),pos.end());
	vector<int> l;
	vector<int> r;
	vector<bool> nin(pos.size(),0);
	int k = (pos.size()/n)/2;
	int cnt = 0;
	for(int i=0;i<pos.size();i++){
		if(cnt==k*n) break;
		vector<int> q;
		nin[i]=1;
		for(int j=0;j<pos.size();j++){
			if(!nin[j]) q.push_back(pos[j]);
		}
		if(Query(q)<k) nin[i]=0;
		else{
			cnt++;
		}
	}
	for(int i=0;i<pos.size();i++){
		if(nin[i]) l.push_back(pos[i]);
		else r.push_back(pos[i]);
	}
	ans(l);
	ans(r);
}

void Solve(int N, int M) {
	n = N;m = M;
	vector<int> pos;
	for(int i=1;i<=N*M;i++){
		pos.push_back(i);
	}
	ans(pos);
}

Compilation message

dango3.cpp: In function 'void ans(std::vector<int>)':
dango3.cpp:16:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |  if(pos.size()==n){Answer(pos);return;}
      |     ~~~~~~~~~~^~~
dango3.cpp:23:15: 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<pos.size();i++){
      |              ~^~~~~~~~~~~
dango3.cpp:27:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int j=0;j<pos.size();j++){
      |               ~^~~~~~~~~~~
dango3.cpp:35:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |  for(int i=0;i<pos.size();i++){
      |              ~^~~~~~~~~~~
dango3.cpp: At global scope:
dango3.cpp:11:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   11 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 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 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 552 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 589 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 739 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -