結果
| 問題 | No.365 ジェンガソート |
| コンテスト | |
| ユーザー |
回転
|
| 提出日時 | 2026-05-22 18:21:23 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 334 bytes |
| 記録 | |
| コンパイル時間 | 162 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 99,072 KB |
| 最終ジャッジ日時 | 2026-05-22 18:21:30 |
| 合計ジャッジ時間 | 3,940 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 30 |
ソースコード
import heapq
N = int(input())
A = list(map(int,input().split()))
A = A[::-1]
ans = 0
count = 1
free = []
while(A):
while(free and free[0] == count):
heapq.heappop(free)
count += 1
if(A[-1] == count):
A.pop()
count += 1
else:
ans += 1
heapq.heappush(free,A.pop())
print(ans)
回転