結果
問題 | No.1525 Meximum Sum |
ユーザー | chineristAC |
提出日時 | 2021-05-30 10:21:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 110 ms / 2,000 ms |
コード長 | 565 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 82,528 KB |
実行使用メモリ | 107,292 KB |
最終ジャッジ日時 | 2024-04-26 07:44:58 |
合計ジャッジ時間 | 3,238 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
56,596 KB |
testcase_01 | AC | 47 ms
56,232 KB |
testcase_02 | AC | 46 ms
56,832 KB |
testcase_03 | AC | 44 ms
56,228 KB |
testcase_04 | AC | 45 ms
56,544 KB |
testcase_05 | AC | 47 ms
57,096 KB |
testcase_06 | AC | 47 ms
56,744 KB |
testcase_07 | AC | 44 ms
57,508 KB |
testcase_08 | AC | 81 ms
96,408 KB |
testcase_09 | AC | 99 ms
105,068 KB |
testcase_10 | AC | 63 ms
77,964 KB |
testcase_11 | AC | 69 ms
84,600 KB |
testcase_12 | AC | 88 ms
99,572 KB |
testcase_13 | AC | 104 ms
107,076 KB |
testcase_14 | AC | 105 ms
107,072 KB |
testcase_15 | AC | 104 ms
107,112 KB |
testcase_16 | AC | 103 ms
107,040 KB |
testcase_17 | AC | 101 ms
107,228 KB |
testcase_18 | AC | 102 ms
107,252 KB |
testcase_19 | AC | 101 ms
107,280 KB |
testcase_20 | AC | 101 ms
107,292 KB |
testcase_21 | AC | 110 ms
107,212 KB |
testcase_22 | AC | 103 ms
107,188 KB |
testcase_23 | AC | 99 ms
107,268 KB |
testcase_24 | AC | 100 ms
107,024 KB |
testcase_25 | AC | 101 ms
107,084 KB |
ソースコード
import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import gcd,log input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) mod = 998888353 N = int(input()) A = li() pos = [-1 for i in range(N)] for i in range(N): pos[A[i]] = i L,R = pos[0],pos[0] res = N for i in range(1,N): pre = (L+1)*(N-R) L = min(L,pos[i]) R = max(R,pos[i]) new = (L+1)*(N-R) res += i * (pre-new) print(res)