結果

問題 No.202 1円玉投げ
ユーザー togatoga
提出日時 2015-09-02 16:32:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 749 ms / 5,000 ms
コード長 638 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 158,192 KB
実行使用メモリ 304,000 KB
最終ジャッジ日時 2024-12-22 10:00:21
合計ジャッジ時間 10,240 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

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