結果
| 問題 | 
                            No.2170 Left Addition Machine
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gew1fw
                         | 
                    
| 提出日時 | 2025-06-12 16:27:08 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 547 bytes | 
| コンパイル時間 | 458 ms | 
| コンパイル使用メモリ | 82,084 KB | 
| 実行使用メモリ | 114,516 KB | 
| 最終ジャッジ日時 | 2025-06-12 16:27:35 | 
| 合計ジャッジ時間 | 7,383 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 TLE * 1 -- * 65 | 
ソースコード
import sys
MOD = 998244353
def main():
    import sys
    sys.setrecursionlimit(1 << 25)
    n, q = map(int, sys.stdin.readline().split())
    A = list(map(int, sys.stdin.readline().split()))
    for _ in range(q):
        L, R = map(int, sys.stdin.readline().split())
        B = A[L-1:R]
        while len(B) > 1:
            max_val = max(B)
            idx = B.index(max_val)
            for j in range(idx):
                B[j] = (B[j] + B[idx]) % MOD
            del B[idx]
        print(B[0] % MOD)
if __name__ == "__main__":
    main()
            
            
            
        
            
gew1fw