結果

問題 No.202 1円玉投げ
ユーザー TLwiegehttTLwiegehtt
提出日時 2015-07-21 05:10:17
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 695 ms / 5,000 ms
コード長 1,378 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 25,300 KB
実行使用メモリ 45,472 KB
最終ジャッジ日時 2023-08-23 23:06:22
合計ジャッジ時間 7,790 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 663 ms
24,700 KB
testcase_01 AC 126 ms
45,472 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 11 ms
43,028 KB
testcase_06 AC 89 ms
45,468 KB
testcase_07 AC 104 ms
45,404 KB
testcase_08 AC 106 ms
45,384 KB
testcase_09 AC 49 ms
45,152 KB
testcase_10 AC 20 ms
43,048 KB
testcase_11 AC 39 ms
45,204 KB
testcase_12 AC 41 ms
43,192 KB
testcase_13 AC 22 ms
42,992 KB
testcase_14 AC 12 ms
43,040 KB
testcase_15 AC 47 ms
45,200 KB
testcase_16 AC 532 ms
8,676 KB
testcase_17 AC 538 ms
43,148 KB
testcase_18 AC 535 ms
43,328 KB
testcase_19 AC 43 ms
45,212 KB
testcase_20 AC 76 ms
45,364 KB
testcase_21 AC 43 ms
45,324 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
5,968 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 9 ms
42,760 KB
testcase_27 AC 9 ms
44,832 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
5,908 KB
testcase_30 AC 9 ms
42,888 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 10 ms
42,972 KB
testcase_33 AC 2 ms
5,924 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 695 ms
43,188 KB
testcase_36 AC 670 ms
10,396 KB
testcase_37 AC 114 ms
45,428 KB
testcase_38 AC 681 ms
43,320 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

#define	CMAX	(100000)

#define WMAX	(32)
#define	HMAX	(32)

int field[HMAX+2][WMAX+2][10000];
int fCnt[HMAX+2][WMAX+2];

int coin[CMAX+2];

int main(void){
	int i,j,k,n;
	int cCnt=0;
	
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		int nx, ny;
		scanf("%d %d", &nx, &ny);
		coin[i] = nx*100000+ny;
	}
	
	for(i=0;i<n;i++){
		int noHit=1;
		int nx, ny;
		int px, py;
		
		nx = coin[i] / 100000;
		ny = coin[i] % 100000;
		
		px = nx/(20000/WMAX);
		py = ny/(20000/HMAX);
		
//		printf("for i  %d %d %d %d %d\n", i, nx, ny, px, py);
//		printf("for ii  px=%d/(20000/%d) , py=%d/(20000/%d)\n", nx,WMAX, ny, HMAX);
		
		for(j=-1;j<=1;j++){
			for(k=-1;k<=1;k++){
				int s;
				int fx = px+k;
				int fy = py+j;
				
				
				if(fx < 0 || WMAX < fx){continue;}
				if(fy < 0 || HMAX < fy){continue;}
				
//				printf("ff %d %d %d %d %d\n", nx, ny, fx, fy, fCnt[fy][fx]);
				
				for(s=0;s<fCnt[fy][fx];s++){
					int tx = field[fy][fx][s] / 100000;
					int ty = field[fy][fx][s] % 100000;
					int len = (nx-tx)*(nx-tx)+(ny-ty)*(ny-ty);
					
					if( len < 20*20){
						noHit = 0;
						j=k=10;
						break;
					}
				}
			}
		}
		
		if(noHit == 1){
			field[py][px][fCnt[py][px]] = nx*100000+ny;
			fCnt[py][px] += 1;
			
			cCnt += 1;
			
//			printf("Add px[%d], py[%d], fCnt[py][px]=[%d]\n", px, py, fCnt[py][px]);
		}
	}
	
	printf("%d\n", cCnt);
	return 0;
}
0