結果

問題 No.202 1円玉投げ
ユーザー togatogatogatoga
提出日時 2015-09-02 16:32:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 833 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 1,363 ms
コンパイル使用メモリ 144,124 KB
実行使用メモリ 303,756 KB
最終ジャッジ日時 2023-08-23 23:12:13
合計ジャッジ時間 12,268 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 253 ms
7,744 KB
testcase_01 AC 833 ms
303,756 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 45 ms
26,340 KB
testcase_06 AC 571 ms
209,856 KB
testcase_07 AC 642 ms
224,232 KB
testcase_08 AC 650 ms
225,448 KB
testcase_09 AC 369 ms
155,808 KB
testcase_10 AC 159 ms
79,272 KB
testcase_11 AC 306 ms
135,104 KB
testcase_12 AC 345 ms
137,452 KB
testcase_13 AC 185 ms
86,764 KB
testcase_14 AC 53 ms
30,404 KB
testcase_15 AC 360 ms
152,368 KB
testcase_16 AC 250 ms
9,912 KB
testcase_17 AC 237 ms
8,464 KB
testcase_18 AC 237 ms
8,120 KB
testcase_19 AC 355 ms
145,252 KB
testcase_20 AC 580 ms
197,384 KB
testcase_21 AC 362 ms
144,932 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 4 ms
4,376 KB
testcase_24 AC 4 ms
4,376 KB
testcase_25 AC 5 ms
4,380 KB
testcase_26 AC 11 ms
7,332 KB
testcase_27 AC 11 ms
7,340 KB
testcase_28 AC 4 ms
4,380 KB
testcase_29 AC 5 ms
4,380 KB
testcase_30 AC 11 ms
7,332 KB
testcase_31 AC 4 ms
4,376 KB
testcase_32 AC 12 ms
7,348 KB
testcase_33 AC 7 ms
4,856 KB
testcase_34 AC 5 ms
4,380 KB
testcase_35 AC 237 ms
9,216 KB
testcase_36 AC 236 ms
5,720 KB
testcase_37 AC 694 ms
232,964 KB
testcase_38 AC 242 ms
9,488 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
int N;
const int MAX_XY = 20040;
bool overlap(int y1, int x1, int y2, int x2){
  return (y1 - y2) * (y1 - y2) + (x1 - x2) * (x1 - x2) < 400;
}


bool on_board[MAX_XY][MAX_XY];

int res;
int main(){
  cin >> N;
  for (int i = 0; i < N; i++){
    int x,y;
    cin >> x >> y;
    bool ok = true;
    for (int Y = max(0, y - 20); Y <= y + 20; Y++){
      for (int X = max(0, x - 20); X <= x + 20; X++){
	if (on_board[Y][X]){
	  if (overlap(y, x, Y, X)){
	    ok = false;
	  }
	}
      }
    }
    if (ok){
      on_board[y][x] = true;
      res++;
    }
  }
  cout << res << endl;
  return 0;
}
0