結果

問題 No.1687 What the Heck?
ユーザー tcltktcltk
提出日時 2021-09-30 04:55:52
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 122,692 KB
最終ジャッジ日時 2023-09-24 07:34:24
合計ジャッジ時間 7,415 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 212 ms
89,532 KB
testcase_01 AC 211 ms
89,396 KB
testcase_02 AC 212 ms
89,508 KB
testcase_03 WA -
testcase_04 AC 210 ms
89,324 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 228 ms
100,160 KB
testcase_10 AC 231 ms
97,296 KB
testcase_11 AC 233 ms
97,152 KB
testcase_12 AC 261 ms
122,692 KB
testcase_13 AC 259 ms
122,488 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**10

def solve(N, P):
    if N == 1:
        return 0

    s = N*(N+1)//2
    ans = 0
    for i in range(N):
        if P[i] == N:
            return s - (i+1)*2

N = int(input())
P = list(map(int, input().split()))
print(solve(N, P))
0