結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
|
提出日時 | 2019-10-30 10:42:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 137 ms / 2,000 ms |
コード長 | 453 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 29,096 KB |
最終ジャッジ日時 | 2024-07-07 12:44:05 |
合計ジャッジ時間 | 4,083 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
class Problem0406: def solve(this): n = int(input()) c1 = True res = {} for i in map(int, input().split()): res[i] = res.get(i, 0) + 1 if res[i] >= 2: c1 = False t = sorted(list(res.keys())) c2 = {} for i in range(len(t) - 1): k = abs(t[i+1] - t[i]) c2[k] = c2.get(k, 0) + 1 if c1 and len(c2) == 1: print("YES") else: print("NO") if __name__ == "__main__": problem = Problem0406() problem.solve()