编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#17320 #2012. 小学生的复仇 Accepted 100 1018 ms 15080 K Python 3 / 878 B admin 2024-10-15 14:02:38
import sys

input = lambda: sys.stdin.readline().strip()

def main():
    import sys
    # 读取第一行输入,得到 n
    n_line = input()
    while n_line == '':
        n_line = input()
    n = int(n_line)
    
    # 读取第二行输入,得到 n 个整数
    a = []
    while len(a) < n:
        line = sys.stdin.readline()
        if not line:
            break
        a += list(map(int, line.strip().split()))
    
    if len(a) < n:
        # 如果输入的数字少于 n 个,补充 0
        a += [0] * (n - len(a))
    
    ans = 0
    maxx = 0  # 当前最大值的下标
    
    for i in range(1, n):
        if a[i] > a[maxx]:
            ans += (i - maxx) * a[maxx]
            maxx = i
    
    if maxx < n - 1:
        ans += (n - 1 - maxx) * a[maxx]
    
    print(ans)

if __name__ == "__main__":
    main()
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:20 ms
内存:2844 KiB

输入文件(test0.in

4
1 3 1 5

答案文件(test0.out

7

用户输出

7

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:20 ms
内存:2832 KiB

输入文件(test1.in

5
4 3 1 3 2

答案文件(test1.out

16

用户输出

16

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:32 ms
内存:7080 KiB

输入文件(test2.in

33699
61538 55779 28044 46915 25847 57757 51715 96624 3104 76863 48112 27106 59204 86866 60779 4623
<198399 bytes omitted>

答案文件(test2.out

3368930026

用户输出

3368930026

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:34 ms
内存:7776 KiB

输入文件(test3.in

40138
11033 43462 78159 61245 87601 40044 93159 94320 11043 14325 88380 42237 30541 98491 84246 283
<236344 bytes omitted>

答案文件(test3.out

4013130653

用户输出

4013130653

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:50 ms
内存:12388 KiB

输入文件(test4.in

77919
94494 20021 30513 28701 46650 69587 94262 52986 11545 62937 88334 25886 66425 94296 57778 661
<458651 bytes omitted>

答案文件(test4.out

7790175832

用户输出

7790175832

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:53 ms
内存:13876 KiB

输入文件(test5.in

92435
55813 28166 87336 98912 55343 41233 25522 74870 18677 78021 50223 85223 54350 60621 25226 358
<544373 bytes omitted>

答案文件(test5.out

9242331676

用户输出

9242331676

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:60 ms
内存:14068 KiB

输入文件(test6.in

97219
24246 59496 21537 19025 75499 30224 26081 20215 86357 89960 4204 6580 94127 76997 95066 43981
<572390 bytes omitted>

答案文件(test6.out

9721186984

用户输出

9721186984

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:42 ms
内存:10236 KiB

输入文件(test7.in

60390
55556 77274 21462 18863 97178 5305 4212 94709 93960 52926 83003 16599 639 23101 81812 21076 6
<355561 bytes omitted>

答案文件(test7.out

6038416496

用户输出

6038416496

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:44 ms
内存:10560 KiB

输入文件(test8.in

66757
32945 53040 59000 37415 83641 81308 69658 99316 57602 73697 78867 86468 7172 68090 12382 2281
<392914 bytes omitted>

答案文件(test8.out

6673808753

用户输出

6673808753

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:48 ms
内存:12344 KiB

输入文件(test9.in

77950
27003 50293 42354 28334 11204 68655 55900 71011 72091 29455 53948 74366 41880 14926 36709 429
<458736 bytes omitted>

答案文件(test9.out

7793241156

用户输出

7793241156

系统信息

Exited with return code 0
测试点 #11
Accepted
得分:100
用时:21 ms
内存:3132 KiB

输入文件(test10.in

3184
24226 9165 63223 97675 83448 73320 16454 94865 65476 97860 56350 95888 97402 42984 91391 27231
<18674 bytes omitted>

答案文件(test10.out

317505534

用户输出

317505534

系统信息

Exited with return code 0
测试点 #12
Accepted
得分:100
用时:34 ms
内存:7584 KiB

输入文件(test11.in

39175
27444 61700 34202 46190 14662 13465 47111 16380 82172 81807 2934 61611 67848 71945 51418 9490
<230658 bytes omitted>

答案文件(test11.out

3916264201

用户输出

3916264201

系统信息

Exited with return code 0
测试点 #13
Accepted
得分:100
用时:54 ms
内存:12960 KiB

输入文件(test12.in

87452
78200 46512 25647 11356 78407 24977 97870 12680 19984 10517 2233 5705 9042 50115 76794 40835 
<514992 bytes omitted>

答案文件(test12.out

8743350461

用户输出

8743350461

系统信息

Exited with return code 0
测试点 #14
Accepted
得分:100
用时:45 ms
内存:10892 KiB

输入文件(test13.in

66954
82463 48614 48758 53074 5441 47225 81301 21994 63750 15076 29232 46590 42905 44727 11017 2381
<394172 bytes omitted>

答案文件(test13.out

6694012134

用户输出

6694012134

系统信息

Exited with return code 0
测试点 #15
Accepted
得分:100
用时:41 ms
内存:9876 KiB

输入文件(test14.in

58292
18320 25008 61213 39564 69782 67825 51741 90193 42840 88602 86175 72308 73485 34100 25636 191
<343254 bytes omitted>

答案文件(test14.out

5827730044

用户输出

5827730044

系统信息

Exited with return code 0
测试点 #16
Accepted
得分:100
用时:52 ms
内存:12680 KiB

输入文件(test15.in

84790
10865 44 14987 47892 30370 44262 157 89613 7119 26760 72829 85635 57451 28461 23120 83324 405
<499479 bytes omitted>

答案文件(test15.out

8476753285

用户输出

8476753285

系统信息

Exited with return code 0
测试点 #17
Accepted
得分:100
用时:50 ms
内存:12436 KiB

输入文件(test16.in

78541
39036 55758 36593 59832 25526 44714 86872 38248 52640 99505 32497 89611 97287 14073 13643 750
<462628 bytes omitted>

答案文件(test16.out

7852758054

用户输出

7852758054

系统信息

Exited with return code 0
测试点 #18
Accepted
得分:100
用时:56 ms
内存:13880 KiB

输入文件(test17.in

92598
45670 98124 91690 20822 18042 94262 49110 71000 64938 22005 82132 31972 53659 27141 34177 677
<545185 bytes omitted>

答案文件(test17.out

9258455005

用户输出

9258455005

系统信息

Exited with return code 0
测试点 #19
Accepted
得分:100
用时:36 ms
内存:8056 KiB

输入文件(test18.in

44971
97441 76277 18413 48577 55408 75090 76786 81623 4224 72011 8836 28732 66061 96935 12572 18368
<264813 bytes omitted>

答案文件(test18.out

4495626105

用户输出

4495626105

系统信息

Exited with return code 0
测试点 #20
Accepted
得分:100
用时:57 ms
内存:15080 KiB

输入文件(test19.in

98831
27005 82547 21208 39211 10082 61233 84306 70477 63778 86975 61908 54647 47420 6508 99051 2005
<581848 bytes omitted>

答案文件(test19.out

9882244603

用户输出

9882244603

系统信息

Exited with return code 0
测试点 #21
Accepted
得分:100
用时:34 ms
内存:7508 KiB

输入文件(test20.in

37925
96889 87551 90078 82504 69536 26351 92313 66962 83424 6501 86410 73039 17408 45671 63445 1435
<223306 bytes omitted>

答案文件(test20.out

3792084881

用户输出

3792084881

系统信息

Exited with return code 0
测试点 #22
Accepted
得分:100
用时:44 ms
内存:9668 KiB

输入文件(test21.in

55466
62168 11885 96164 14512 21277 80628 61805 3421 10111 45981 97318 74811 61104 58920 51051 8651
<326501 bytes omitted>

答案文件(test21.out

5545246396

用户输出

5545246396

系统信息

Exited with return code 0
测试点 #23
Accepted
得分:100
用时:47 ms
内存:11444 KiB

输入文件(test22.in

73868
11191 78419 64179 36747 60394 14530 9560 26277 39624 36640 55429 69441 51415 78491 66163 6002
<434886 bytes omitted>

答案文件(test22.out

7385486366

用户输出

7385486366

系统信息

Exited with return code 0
测试点 #24
Accepted
得分:100
用时:44 ms
内存:10776 KiB

输入文件(test23.in

68184
7967 85670 50194 60058 73085 85407 16176 34396 74750 62372 71831 6784 24269 57557 62835 92563
<401402 bytes omitted>

答案文件(test23.out

6816991600

用户输出

6816991600

系统信息

Exited with return code 0