結果
| 問題 |
No.1425 Yet Another Cyclic Shifts Sorting
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:12:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 530 bytes |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 82,312 KB |
| 実行使用メモリ | 117,984 KB |
| 最終ジャッジ日時 | 2025-06-12 14:12:39 |
| 合計ジャッジ時間 | 9,705 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 22 |
ソースコード
n = int(input())
a = list(map(int, input().split()))
sorted_pairs = sorted((val, idx) for idx, val in enumerate(a))
original_pos = [pair[1] for pair in sorted_pairs]
required_tools = set()
i = 0
while i < n:
if original_pos[i] <= i:
i += 1
continue
# Start of a new segment
max_m = original_pos[i]
start = i
while i < n and original_pos[i] > i:
if original_pos[i] > max_m:
max_m = original_pos[i]
i += 1
required_tools.add(max_m + 1)
print(len(required_tools))
gew1fw