結果

問題 No.202 1円玉投げ
ユーザー alpha_virginisalpha_virginis
提出日時 2015-05-04 02:22:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 68 ms / 5,000 ms
コード長 905 bytes
コンパイル時間 1,061 ms
コンパイル使用メモリ 144,280 KB
実行使用メモリ 19,552 KB
最終ジャッジ日時 2023-08-23 22:10:40
合計ジャッジ時間 3,995 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
19,416 KB
testcase_01 AC 67 ms
19,472 KB
testcase_02 AC 8 ms
19,284 KB
testcase_03 AC 9 ms
19,552 KB
testcase_04 AC 9 ms
19,340 KB
testcase_05 AC 12 ms
19,228 KB
testcase_06 AC 61 ms
19,416 KB
testcase_07 AC 63 ms
19,228 KB
testcase_08 AC 65 ms
19,288 KB
testcase_09 AC 39 ms
19,228 KB
testcase_10 AC 21 ms
19,468 KB
testcase_11 AC 32 ms
19,416 KB
testcase_12 AC 34 ms
19,328 KB
testcase_13 AC 22 ms
19,468 KB
testcase_14 AC 12 ms
19,352 KB
testcase_15 AC 38 ms
19,236 KB
testcase_16 AC 57 ms
19,240 KB
testcase_17 AC 60 ms
19,468 KB
testcase_18 AC 59 ms
19,464 KB
testcase_19 AC 36 ms
19,408 KB
testcase_20 AC 51 ms
19,244 KB
testcase_21 AC 35 ms
19,232 KB
testcase_22 AC 9 ms
19,464 KB
testcase_23 AC 8 ms
19,468 KB
testcase_24 AC 8 ms
19,404 KB
testcase_25 AC 8 ms
19,240 KB
testcase_26 AC 8 ms
19,268 KB
testcase_27 AC 8 ms
19,240 KB
testcase_28 AC 8 ms
19,468 KB
testcase_29 AC 8 ms
19,512 KB
testcase_30 AC 9 ms
19,344 KB
testcase_31 AC 9 ms
19,464 KB
testcase_32 AC 9 ms
19,400 KB
testcase_33 AC 9 ms
19,464 KB
testcase_34 AC 8 ms
19,244 KB
testcase_35 AC 59 ms
19,412 KB
testcase_36 AC 67 ms
19,340 KB
testcase_37 AC 68 ms
19,268 KB
testcase_38 AC 63 ms
19,408 KB
testcase_39 AC 8 ms
19,228 KB
testcase_40 AC 8 ms
19,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

inline int ch(int a, int b) {
  return (a << 11) | b;
}

int main() {
  
  int N;
  int x, y;
  int x0, x1, y0, y1;

  int* p;
  int ans = 0;
  int temp;

  p = new int[2048*2048];

  for(int i = 0; i < 2048; ++i) {
    for(int j = 0; j < 2048; ++j) {
      p[ ch(i,j) ] = 0;
    }
  }
  
  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> x >> y;
    x += 30;
    y += 30;
    for(int j = -2; j <= 2; ++j) {
      for(int k = -2; k <= 2; ++k) {
	temp = p[ ch(x/10 + j, y/10 + k) ];
	if( p[ ch(x/10 + j, y/10 + k) ] != 0 ) {
	  x0 = temp >> 16;
	  y0 = temp & 0xffff;
	  x1 = x;
	  y1 = y;
	  temp = (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1);
	  if( temp < 400 ) {
	    goto label_1;
	  }
	}
      }
    }
    p[ ch(x/10, y/10) ] = (x << 16) | y;
    ans += 1;
  label_1:    
    ans = ans;
  }
  
  std::cout << ans << std::endl;
  
  delete p;

  return 0;
}

0