結果
問題 | No.321 (P,Q)-サンタと街の子供たち |
ユーザー | nebukuro09 |
提出日時 | 2017-06-14 09:55:10 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,134 bytes |
コンパイル時間 | 1,332 ms |
コンパイル使用メモリ | 102,996 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2023-09-03 14:20:26 |
合計ジャッジ時間 | 3,811 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 1 ms
4,380 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 45 ms
4,968 KB |
testcase_15 | AC | 70 ms
4,376 KB |
testcase_16 | AC | 27 ms
4,380 KB |
testcase_17 | AC | 1 ms
4,376 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 42 ms
4,376 KB |
testcase_22 | AC | 13 ms
4,380 KB |
testcase_23 | AC | 59 ms
4,380 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 73 ms
7,720 KB |
testcase_30 | AC | 3 ms
4,376 KB |
testcase_31 | WA | - |
testcase_32 | AC | 37 ms
4,376 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 54 ms
4,380 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | AC | 12 ms
4,380 KB |
testcase_40 | WA | - |
testcase_41 | AC | 18 ms
4,380 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
コンパイルメッセージ
/dmd2/linux/bin64/../../src/phobos/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!uint.gcdImpl`
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto s = readln.split.map!(to!int); auto P = s[0]; auto Q = s[1]; auto N = readln.chomp.to!int; if (P > Q) swap(P, Q); if (P == 0 && Q == 0) { int ans = 0; while (N--) { s = readln.split.map!(to!int); if (s[0] == 0 && s[1] == 0) ans++; } ans.writeln; return; } else if (P == 0) { int ans = 0; while (N--) { s = readln.split.map!(to!int); if (s[0] % Q == 0 && s[1] % Q == 0) ans ++; } ans.writeln; return; } auto G = gcd(P, Q); P /= G; Q /= G; int ans = 0; while (N--) { s = readln.split.map!(to!int); auto x = s[0]; auto y = s[1]; if (x % G > 0 || y % G > 0) continue; x /= G; y /= G; if (P % 2 == 0 || Q % 2 == 0 || (x + y) % 2 == 0) ans += 1; } ans.writeln; }