結果
問題 | No.1525 Meximum Sum |
ユーザー | chineristAC |
提出日時 | 2021-05-30 10:13:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 108 ms / 2,000 ms |
コード長 | 620 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,108 KB |
実行使用メモリ | 107,300 KB |
最終ジャッジ日時 | 2024-04-26 07:44:34 |
合計ジャッジ時間 | 3,335 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
56,296 KB |
testcase_01 | AC | 49 ms
56,308 KB |
testcase_02 | AC | 54 ms
56,752 KB |
testcase_03 | AC | 45 ms
56,852 KB |
testcase_04 | AC | 44 ms
56,428 KB |
testcase_05 | AC | 51 ms
56,644 KB |
testcase_06 | AC | 42 ms
56,076 KB |
testcase_07 | AC | 48 ms
57,056 KB |
testcase_08 | AC | 85 ms
95,920 KB |
testcase_09 | AC | 97 ms
104,784 KB |
testcase_10 | AC | 66 ms
77,336 KB |
testcase_11 | AC | 69 ms
83,900 KB |
testcase_12 | AC | 87 ms
99,788 KB |
testcase_13 | AC | 103 ms
107,124 KB |
testcase_14 | AC | 108 ms
107,116 KB |
testcase_15 | AC | 105 ms
106,992 KB |
testcase_16 | AC | 104 ms
107,136 KB |
testcase_17 | AC | 102 ms
107,300 KB |
testcase_18 | AC | 103 ms
106,876 KB |
testcase_19 | AC | 103 ms
107,148 KB |
testcase_20 | AC | 100 ms
106,992 KB |
testcase_21 | AC | 108 ms
106,900 KB |
testcase_22 | AC | 105 ms
107,168 KB |
testcase_23 | AC | 100 ms
106,940 KB |
testcase_24 | AC | 96 ms
107,040 KB |
testcase_25 | AC | 99 ms
107,020 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() if N in A: for i in range(N): A[i] -= 1 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)