結果

問題 No.202 1円玉投げ
ユーザー nebukuro09
提出日時 2016-11-16 20:25:23
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 1,084 ms / 5,000 ms
コード長 857 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 110,940 KB
実行使用メモリ 404,176 KB
最終ジャッジ日時 2024-06-12 05:06:28
合計ジャッジ時間 21,694 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;

void main() {
  auto N = readln.chomp.to!int;

  alias Tuple!(int, "x", int, "y") point;
  point[] check;
  foreach (x; iota(-20, 21))
    foreach (y; iota(-20, 21))
      if (x*x+y*y < 400)
	check ~= point(x, y);

  auto mem = new bool[][](20001, 20001);
  int ans = 0;

  foreach (i; 0..N) {
    auto input = readln.split.map!(to!int);
    auto x = input[0];
    auto y = input[1];
    bool flag = true;
    foreach (p; check) {
      if (x+p.x < 0 || x+p.x >= 20001 || y+p.y < 0 || y+p.y >= 20001)
	continue;
      if (mem[x+p.x][y+p.y]) {
	flag = false;
	break;
      }
    }
    if (flag) {
      ans += 1;
      mem[x][y] = true;
    }
  }

  writeln(ans);
}
0