結果
問題 | No.990 N×Mマス計算(Kの倍数) |
ユーザー | nehan_der_thal |
提出日時 | 2020-02-27 23:43:16 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 868 bytes |
コンパイル時間 | 154 ms |
コンパイル使用メモリ | 82,576 KB |
実行使用メモリ | 118,828 KB |
最終ジャッジ日時 | 2024-04-27 21:38:56 |
合計ジャッジ時間 | 4,150 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 124 ms
88,372 KB |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | AC | 120 ms
88,644 KB |
testcase_04 | RE | - |
testcase_05 | AC | 119 ms
88,304 KB |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 118 ms
88,596 KB |
testcase_09 | AC | 120 ms
88,376 KB |
testcase_10 | AC | 156 ms
105,524 KB |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 172 ms
103,840 KB |
testcase_17 | WA | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | AC | 216 ms
118,828 KB |
ソースコード
import sys input = sys.stdin.readline from collections import defaultdict import fractions N, M, K = map(int, input().split()) R = 0 bs = [] fs = [] for i in range(N+1): if i == 0: X = input().split() e = X[0] == '+' if e: d = defaultdict(int) for x in X[1:]: d[K-int(x)%K] += 1 else: bs = list(map(int, X[1:])) d = defaultdict(int) for b in bs: b = fractions.gcd(b, K) d[b] += 1 continue x = int(input()) if e: R += d[x%K] else: fs.append(x) if e: print(R) else: d2 = defaultdict(int) for b in fs: b = fractions.gcd(b, K) d2[b] += 1 for c in d: for e in d2: if fractions.gcd(c*e, K) == K: R += d[c]*d2[e] print(R)