結果
問題 | No.1525 Meximum Sum |
ユーザー | chineristAC |
提出日時 | 2021-05-30 10:10:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 106 ms / 2,000 ms |
コード長 | 565 bytes |
コンパイル時間 | 255 ms |
コンパイル使用メモリ | 82,408 KB |
実行使用メモリ | 107,360 KB |
最終ジャッジ日時 | 2024-04-26 07:44:25 |
合計ジャッジ時間 | 3,413 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
55,936 KB |
testcase_01 | AC | 46 ms
56,064 KB |
testcase_02 | AC | 45 ms
55,936 KB |
testcase_03 | AC | 48 ms
55,808 KB |
testcase_04 | AC | 45 ms
55,808 KB |
testcase_05 | AC | 45 ms
55,680 KB |
testcase_06 | AC | 45 ms
55,808 KB |
testcase_07 | AC | 45 ms
56,064 KB |
testcase_08 | AC | 84 ms
94,592 KB |
testcase_09 | AC | 98 ms
105,116 KB |
testcase_10 | AC | 63 ms
76,464 KB |
testcase_11 | AC | 70 ms
83,316 KB |
testcase_12 | AC | 89 ms
99,248 KB |
testcase_13 | AC | 105 ms
107,240 KB |
testcase_14 | AC | 105 ms
107,348 KB |
testcase_15 | AC | 105 ms
107,160 KB |
testcase_16 | AC | 104 ms
107,124 KB |
testcase_17 | AC | 104 ms
106,992 KB |
testcase_18 | AC | 103 ms
107,324 KB |
testcase_19 | AC | 106 ms
107,044 KB |
testcase_20 | AC | 104 ms
106,928 KB |
testcase_21 | AC | 106 ms
107,152 KB |
testcase_22 | AC | 104 ms
107,092 KB |
testcase_23 | AC | 100 ms
107,360 KB |
testcase_24 | AC | 100 ms
107,000 KB |
testcase_25 | AC | 101 ms
107,056 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)