結果
問題 |
No.2170 Left Addition Machine
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:33:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 962 bytes |
コンパイル時間 | 401 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 51,840 KB |
最終ジャッジ日時 | 2025-06-12 21:34:27 |
合計ジャッジ時間 | 7,455 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 65 |
ソースコード
import sys MOD = 998244353 def main(): input = sys.stdin.read data = input().split() idx = 0 N = int(data[idx]) idx += 1 Q = int(data[idx]) idx += 1 A = list(map(int, data[idx:idx+N])) idx += N queries = [] for _ in range(Q): L = int(data[idx]) - 1 idx += 1 R = int(data[idx]) - 1 idx += 1 queries.append((L, R)) # Precompute the necessary information # Here, we'll process each query directly for demonstration # Note: This is a simplified approach and may not pass all test cases due to time constraints. for L, R in queries: sub = A[L:R+1] while len(sub) > 1: max_val = max(sub) first_max_idx = sub.index(max_val) for j in range(first_max_idx): sub[j] = (sub[j] + max_val) % MOD sub.pop(first_max_idx) print(sub[0] % MOD) if __name__ == '__main__': main()