結果

問題 No.202 1円玉投げ
ユーザー FF256grhyFF256grhy
提出日時 2015-05-04 02:10:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 945 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 26,812 KB
実行使用メモリ 39,156 KB
最終ジャッジ日時 2023-08-23 22:10:33
合計ジャッジ時間 2,474 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,204 KB
testcase_01 AC 38 ms
39,092 KB
testcase_02 AC 2 ms
7,140 KB
testcase_03 AC 2 ms
7,140 KB
testcase_04 AC 2 ms
7,120 KB
testcase_05 AC 14 ms
38,208 KB
testcase_06 AC 35 ms
39,008 KB
testcase_07 AC 38 ms
39,048 KB
testcase_08 AC 37 ms
39,156 KB
testcase_09 AC 26 ms
38,768 KB
testcase_10 AC 18 ms
38,412 KB
testcase_11 AC 24 ms
38,644 KB
testcase_12 AC 26 ms
38,688 KB
testcase_13 AC 19 ms
38,548 KB
testcase_14 AC 15 ms
38,312 KB
testcase_15 AC 26 ms
38,716 KB
testcase_16 AC 29 ms
38,268 KB
testcase_17 AC 22 ms
12,532 KB
testcase_18 AC 22 ms
12,568 KB
testcase_19 AC 24 ms
38,672 KB
testcase_20 AC 33 ms
38,896 KB
testcase_21 AC 25 ms
38,656 KB
testcase_22 AC 11 ms
37,980 KB
testcase_23 AC 13 ms
37,744 KB
testcase_24 AC 3 ms
9,332 KB
testcase_25 AC 3 ms
7,364 KB
testcase_26 AC 3 ms
7,040 KB
testcase_27 AC 2 ms
5,076 KB
testcase_28 AC 2 ms
5,124 KB
testcase_29 AC 2 ms
5,100 KB
testcase_30 AC 11 ms
37,716 KB
testcase_31 AC 2 ms
7,096 KB
testcase_32 AC 11 ms
36,316 KB
testcase_33 AC 3 ms
9,352 KB
testcase_34 AC 3 ms
9,312 KB
testcase_35 AC 22 ms
12,372 KB
testcase_36 AC 34 ms
38,632 KB
testcase_37 AC 39 ms
39,024 KB
testcase_38 AC 23 ms
12,332 KB
testcase_39 AC 5 ms
16,028 KB
testcase_40 AC 4 ms
15,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

#define MAX 100000
int xlist[1003][1003][4], ylist[1003][1003][4]; // ceil(20001 / 20) + 2, 5個は入らない  // ここが盛大に間違っていた……
int num[1003][1003];

int main(void) {
	int n, x[MAX], y[MAX];
	scanf("%d", &n);
	int i, j, k, l;
	for(i = 0; i < n; i++) {
		scanf("%d %d", &x[i], &y[i]);
	}
	
	int answer = 0;
	for(i = 0; i < n; i++) {
		int xp = x[i] / 20 + 1;
		int yp = y[i] / 20 + 1;
		int flag = 0;
		for(j = xp - 1; j <= xp + 1; j++) {
		for(k = yp - 1; k <= yp + 1; k++) {
			for(l = 0; l < num[j][k]; l++) {
				if ( (x[i] - xlist[j][k][l]) * (x[i] - xlist[j][k][l]) + (y[i] - ylist[j][k][l]) * (y[i] - ylist[j][k][l]) < 400 ) {
					flag = 1;
					break;
				}
			}
		if(flag) { break; }
		}
		if(flag) { break; }
		}
		if(! flag) {
			xlist[xp][yp][ num[xp][yp] ] = x[i];
			ylist[xp][yp][ num[xp][yp] ] = y[i];
			num[xp][yp]++;
			answer++;
		}
	}
	printf("%d\n", answer);
	return 0;
}
0