結果

問題 No.202 1円玉投げ
ユーザー alpha_virginisalpha_virginis
提出日時 2015-05-04 02:07:33
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 80 ms / 5,000 ms
コード長 920 bytes
コンパイル時間 1,343 ms
コンパイル使用メモリ 144,408 KB
実行使用メモリ 20,876 KB
最終ジャッジ日時 2023-08-23 22:10:30
合計ジャッジ時間 4,341 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
20,592 KB
testcase_01 AC 80 ms
20,596 KB
testcase_02 AC 16 ms
20,716 KB
testcase_03 AC 15 ms
20,580 KB
testcase_04 AC 14 ms
20,600 KB
testcase_05 AC 17 ms
20,616 KB
testcase_06 AC 63 ms
20,684 KB
testcase_07 AC 72 ms
20,576 KB
testcase_08 AC 74 ms
20,680 KB
testcase_09 AC 48 ms
20,632 KB
testcase_10 AC 28 ms
20,576 KB
testcase_11 AC 40 ms
20,576 KB
testcase_12 AC 42 ms
20,628 KB
testcase_13 AC 29 ms
20,608 KB
testcase_14 AC 19 ms
20,580 KB
testcase_15 AC 47 ms
20,756 KB
testcase_16 AC 64 ms
20,668 KB
testcase_17 AC 65 ms
20,700 KB
testcase_18 AC 64 ms
20,596 KB
testcase_19 AC 43 ms
20,588 KB
testcase_20 AC 58 ms
20,632 KB
testcase_21 AC 44 ms
20,676 KB
testcase_22 AC 16 ms
20,580 KB
testcase_23 AC 16 ms
20,632 KB
testcase_24 AC 16 ms
20,604 KB
testcase_25 AC 16 ms
20,620 KB
testcase_26 AC 15 ms
20,600 KB
testcase_27 AC 16 ms
20,580 KB
testcase_28 AC 16 ms
20,804 KB
testcase_29 AC 15 ms
20,608 KB
testcase_30 AC 15 ms
20,744 KB
testcase_31 AC 15 ms
20,604 KB
testcase_32 AC 16 ms
20,836 KB
testcase_33 AC 15 ms
20,680 KB
testcase_34 AC 15 ms
20,620 KB
testcase_35 AC 64 ms
20,636 KB
testcase_36 AC 71 ms
20,748 KB
testcase_37 AC 78 ms
20,636 KB
testcase_38 AC 68 ms
20,748 KB
testcase_39 AC 16 ms
20,592 KB
testcase_40 AC 15 ms
20,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

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

  int* p[2100];
  int ans = 0;
  int temp;

  for(int i = 0; i < 2100; ++i) {
    p[i] = new int[2100];
  }

  for(int i = 0; i < 2100; ++i) {
    for(int j = 0; j < 2100; ++j) {
      p[i][j] = -1;
    }
  }
  
  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> x >> y;
    x += 20;
    y += 20;
    for(int j = -2; j <= 2; ++j) {
      for(int k = -2; k <= 2; ++k) {
	temp = p[x/10 + j][y/10 + k];
	if( p[x/10 + j][y/10 + k] != -1 ) {
	  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[x/10][y/10] = (x << 16) | y;
    ans += 1;
  label_1:    
    ans = ans;
  }
  
  std::cout << ans << std::endl;
  
  for(int i = 0; i < 2100; ++i) {
    delete [] p[i];
  }
  

  return 0;
}

0