結果
問題 | No.1537 私の代わりに仕事やっといてください。 |
ユーザー | ygd. |
提出日時 | 2021-06-12 21:03:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 702 ms / 2,000 ms |
コード長 | 884 bytes |
コンパイル時間 | 355 ms |
コンパイル使用メモリ | 86,920 KB |
実行使用メモリ | 125,572 KB |
最終ジャッジ日時 | 2023-08-22 18:16:19 |
合計ジャッジ時間 | 3,891 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 97 ms
71,348 KB |
testcase_01 | AC | 94 ms
71,332 KB |
testcase_02 | AC | 702 ms
125,572 KB |
testcase_03 | AC | 93 ms
71,468 KB |
testcase_04 | AC | 95 ms
71,344 KB |
testcase_05 | AC | 94 ms
71,468 KB |
testcase_06 | AC | 96 ms
71,460 KB |
testcase_07 | AC | 112 ms
77,352 KB |
testcase_08 | AC | 111 ms
77,704 KB |
testcase_09 | AC | 120 ms
77,788 KB |
testcase_10 | AC | 148 ms
79,232 KB |
ソースコード
from collections import deque def main(): N = int(input()) A = list(map(int,input().split())) Z = [] for i,a in enumerate(A): Z.append((a,i+1)) #1-index Z.sort() ans = [] idx = 0 while True: ans.append(Z[idx][1]) if idx + 2 < N: idx += 2 Flag = 0 elif idx + 1 < N: idx += 1 Flag = 1 else: break if Flag == 0: idx -= 1 else: idx -= 2 while True: ans.append(Z[idx][1]) if idx - 2 >= 0: idx -= 2 elif idx - 1 >= 0: idx -= 1 else: break #print(ans) ans.pop() #最後の2回目は不要 ret = deque(ans) while ret[0] != 1: v = ret.popleft() ret.append(v) ret.append(1) print(*ret) if __name__ == '__main__': main()