結果
| 問題 |
No.2170 Left Addition Machine
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:25:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 962 bytes |
| コンパイル時間 | 282 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 147,200 KB |
| 最終ジャッジ日時 | 2025-06-12 16:26:04 |
| 合計ジャッジ時間 | 8,852 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()
gew1fw