結果
問題 | No.2335 Jump |
ユーザー |
![]() |
提出日時 | 2023-06-02 22:08:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 969 bytes |
コンパイル時間 | 327 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 94,976 KB |
最終ジャッジ日時 | 2024-12-28 18:17:01 |
合計ジャッジ時間 | 2,483 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 15 |
ソースコード
# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1")# from bisect import *from collections import *# from heapq import *# from itertools import *# from math import *# from datetime import *# from decimal import*# from string import ascii_lowercase,ascii_uppercase# import numpy as npimport sysimport os# sys.setrecursionlimit(10**6)INF = 10**18MOD = 998244353# MOD = 10**9 + 7File = open("input.txt", "r") if os.path.exists("input.txt") else sys.stdindef input():return File.readline()[:-1]# ///////////////////////////////////////////////////////////////////////////N = int(input())A = list(map(int, input().split()))l = deque([[0, 0]])for i in range(N):if i == 0:deque.append(l, [A[i], 1])continueif A[i] - A[i - 1] == 1:l[-1][1] += 1else:deque.append(l, [A[i], 1])ans = 0for i in range(len(l) - 1):pop = deque.pop(l)ans += pop[0] - l[-1][0] - 1print(ans)