답안 #71606

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71606 2018-08-25T08:30:29 Z 윤교준(#2220) 행성 탐사 (GA8_planet) C++11
0 / 100
3 ms 484 KB
#include "planet.h"
#include <bits/stdc++.h>
using namespace std;
int rd(int s, int e) { return rand() % (e-s+1) + s; }

inline int f(int i) {
	if(i < 0) return 2222+i;
	if(2222 <= i) return i-2222;
	return i;
}

void ainta() {
	for(int i = 0; i < 101; i++) paint(f(-i), f(-i));
}

void sangsoo() {
	srand(time(0));
	int dx = rd(0, 2221), dy = rd(0, 2221);
	int x = -1, y = -1, ll = -1;

	{
		int i = 0;
		for(int t;; i++) {
			t = count_row(f(i*(i+1)/2 + dx));
			if(t) break;
		}
		int s = i*(i+1)/2 + dx, e = s+i + dx;
		for(int m; s < e;) {
			m = (s+e+1) >> 1; i++;
			if(count_row(f(m))) s = m;
			else e = m-1;
		}
		x = s;
		ll = i+1;
	}

	{
		int i = 0, idx = dy;
		for(int t;; i++) {
			t = count_col(f(idx));
			if(t) break;
			idx += ll+i+1;
		}
		int s = idx, e = idx+ll+i;
		for(int m; s < e;) {
			m = (s+e+1) >> 1;
			if(count_col(f(m))) s = m;
			else e = m-1;
		}
		y = s;
	}

	report(f(x), f(y));
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 376 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 484 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -