結果

問題 No.2119 一般化百五減算
ユーザー flygonflygon
提出日時 2022-11-04 22:14:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,360 KB
実行使用メモリ 89,264 KB
最終ジャッジ日時 2023-09-26 00:41:28
合計ジャッジ時間 4,396 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,128 KB
testcase_01 AC 70 ms
71,276 KB
testcase_02 AC 69 ms
71,312 KB
testcase_03 AC 70 ms
71,280 KB
testcase_04 AC 74 ms
75,872 KB
testcase_05 AC 70 ms
71,600 KB
testcase_06 AC 70 ms
71,104 KB
testcase_07 AC 76 ms
75,892 KB
testcase_08 AC 72 ms
71,428 KB
testcase_09 AC 76 ms
75,936 KB
testcase_10 AC 71 ms
71,520 KB
testcase_11 AC 71 ms
71,460 KB
testcase_12 AC 76 ms
76,092 KB
testcase_13 AC 69 ms
71,272 KB
testcase_14 AC 73 ms
71,480 KB
testcase_15 AC 72 ms
71,476 KB
testcase_16 AC 70 ms
71,388 KB
testcase_17 AC 71 ms
71,092 KB
testcase_18 AC 70 ms
71,280 KB
testcase_19 AC 70 ms
71,436 KB
testcase_20 AC 243 ms
86,016 KB
testcase_21 AC 239 ms
85,148 KB
testcase_22 AC 307 ms
89,176 KB
testcase_23 AC 309 ms
89,100 KB
testcase_24 AC 306 ms
89,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
m = int(input())
bc = [list(map(int,input().split())) for i in range(m)] 

p = [i for i in range(n+1)]
bc.sort(key = lambda x:-x[0])
for b,c in bc:
  c%=b
  new = []
  for i in p:
    if i % b == c:
      new.append(i)
  p = new
if not p:
  print("NaN")
else:
  print(p[0])
0