結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-16 11:13:17 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,208 bytes |
| コンパイル時間 | 1,050 ms |
| コンパイル使用メモリ | 128,256 KB |
| 実行使用メモリ | 30,208 KB |
| 最終ジャッジ日時 | 2024-06-12 04:26:27 |
| 合計ジャッジ時間 | 14,563 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 37 |
コンパイルメッセージ
Main.d(18): Deprecation: foreach: loop index implicitly converted from `size_t` to `int`
ソースコード
import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.regex, std.conv, std.stdio, std.typecons;
auto maxX = 20000, maxY = 20000;
void main()
{
auto n = readln.chomp.to!size_t;
auto pi = iota(n)
.map!(_ => readln.split.map!(to!int))
.map!(rd => point(rd[0], rd[1])).array;
auto xb = new int[][](maxX + 1);
auto yb = new int[][](maxY + 1);
auto r = 0;
loop: foreach (int i, p; pi) {
auto xi = max(p.x - 10, 0), xa = min(p.x + 10, maxX);
auto yi = max(p.y - 10, 0), ya = min(p.y + 10, maxY);
int[] xc, yc;
foreach (x; xi..xa+1) xc ~= xb[x];
foreach (y; yi..ya+1) yc ~= yb[y];
foreach (c; setIntersection(xc.sort().uniq(), yc.sort().uniq()))
if ((p - pi[c]).hypot2 < 400) continue loop;
xb[xi] ~= i; xb[xa] ~= i;
yb[yi] ~= i; yb[ya] ~= i;
++r;
}
writeln(r);
}
struct Point(T) {
T x, y;
point opBinary(string op)(point rhs) {
static if (op == "+") return point(x + rhs.x, y + rhs.y);
else static if (op == "-") return point(x - rhs.x, y - rhs.y);
}
int hypot2() { return x ^^ 2 + y ^^ 2; }
}
alias Point!int point;