Submission #29040

# Submission time Handle Problem Language Result Execution time Memory
29040 2017-07-18T07:22:05 Z 서규호(#1171) Park (JOI17_park) C++14
0 / 100
0 ms 2116 KB
#include "park.h"
#include <bits/stdc++.h>
#include <unistd.h>

#define pb push_back

using namespace std;

static int N;
static int place[1400];

static void divide(int s,int e,vector<int> tmp){
	if(tmp.size() == 0){
		Answer(min(s,e),max(s,e));
		return;
	}else if(tmp.size() == 1){
		Answer(min(s,tmp[0]),max(s,tmp[0]));
		Answer(min(tmp[0],e),max(tmp[0],e));
		return;
	}

	int value;
	vector<int> tmp1,tmp2;
	value = rand()%tmp.size(); value = tmp[value];
	for(int i=0; i<tmp.size(); i++){
		if(tmp[i] == value) continue;
		for(int j=0; j<N; j++) place[j] = 1;
		place[tmp[i]] = 0;
		if(Ask(s,value,place)){
			tmp2.pb(tmp[i]);
		}else tmp1.pb(tmp[i]);
	}
	divide(s,value,tmp1);
	divide(value,e,tmp2);
}

void Detect(int T, int n) {
	srand(time(NULL)+getpid());
	N = n;
	if(T == 1){
		for(int i=0; i<N; i++){
			for(int j=i+1; j<N; j++){
				place[i] = place[j] = true;
				if(Ask(i,j,place)) Answer(i,j);
				place[i] = place[j] = false;
			}
		}
	}else if(T == 2){
		vector<int> tmp;
		for(int i=1; i<N-1; i++) tmp.pb(i);
		divide(0,N-1,tmp);
	}
}

Compilation message

park.cpp: In function 'void divide(int, int, std::vector<int>)':
park.cpp:25:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<tmp.size(); i++){
                ^
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2116 KB Execution killed because of forbidden syscall getpid (39)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2116 KB Execution killed because of forbidden syscall getpid (39)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2116 KB Execution killed because of forbidden syscall getpid (39)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2116 KB Execution killed because of forbidden syscall getpid (39)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2116 KB Execution killed because of forbidden syscall getpid (39)
2 Halted 0 ms 0 KB -