結果

問題 No.2119 一般化百五減算
ユーザー タコイモタコイモ
提出日時 2022-11-04 22:29:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 103,840 KB
最終ジャッジ日時 2023-09-26 00:59:45
合計ジャッジ時間 3,613 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,544 KB
testcase_01 AC 70 ms
71,432 KB
testcase_02 AC 69 ms
71,392 KB
testcase_03 AC 69 ms
71,660 KB
testcase_04 AC 71 ms
76,452 KB
testcase_05 AC 77 ms
71,552 KB
testcase_06 AC 67 ms
71,456 KB
testcase_07 AC 70 ms
76,576 KB
testcase_08 AC 67 ms
71,452 KB
testcase_09 AC 68 ms
76,188 KB
testcase_10 AC 67 ms
71,396 KB
testcase_11 AC 67 ms
71,112 KB
testcase_12 AC 70 ms
75,896 KB
testcase_13 AC 64 ms
71,404 KB
testcase_14 AC 65 ms
71,308 KB
testcase_15 AC 66 ms
71,448 KB
testcase_16 AC 68 ms
71,452 KB
testcase_17 AC 67 ms
71,144 KB
testcase_18 AC 65 ms
71,124 KB
testcase_19 AC 67 ms
71,456 KB
testcase_20 AC 164 ms
96,624 KB
testcase_21 AC 142 ms
94,916 KB
testcase_22 AC 190 ms
103,832 KB
testcase_23 AC 190 ms
103,840 KB
testcase_24 AC 190 ms
103,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = int(input())
true = [set() for _ in range(M+1)]
true[0] = {i for i in range(N+1)}

for i in range(1,M+1):
  b,c = map(int,input().split())
  d = c%b
  
  for j in true[i-1]:
    if j % b == d:
      true[i].add(j)
if len(true[M]) == 0:
  print('NaN')
  exit()
print(min(true[M]))
    
  
  

  
  
  

  
0