結果
| 問題 | 
                            No.2119 一般化百五減算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-11-04 22:28:03 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 316 bytes | 
| コンパイル時間 | 299 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 102,344 KB | 
| 最終ジャッジ日時 | 2024-07-18 20:24:06 | 
| 合計ジャッジ時間 | 3,285 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 RE * 22 | 
ソースコード
N = int(input())
M = int(input())
true = [set() for _ in range(N+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[N]) == 0:
  print('NaN')
print(min(true[N]))