QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#227361#3426. Icons in the ToolbarBashca#AC ✓48ms14968kbC++23559b2023-10-27 13:14:242023-10-27 13:14:24

Judging History

你现在查看的是最新测评结果

  • [2023-10-27 13:14:24]
  • 评测
  • 测评结果:AC
  • 用时:48ms
  • 内存:14968kb
  • [2023-10-27 13:14:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> v(2*n);
    for (int i=0; i< 2*n; ++i) cin>>v[i];
    vector<long long> sum(2 * n + 1);
    for (int i = 2*n-2; i >= 0; i -= 2) {
        sum[i] = v[i] + sum[i+2];
    }    
    long long ans = 1e18;
    long long pref = v[0];
    for (int i = 1; i <= n; ++i) {
        ans = min(ans, (v[0] + v[i]) * (pref + sum[2 * i]));
        pref += v[i];
    }  
    cout << ans << '\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3476kb

input:

5
18
17
17
15
15
14
13
6
6
6

output:

2343

result:

ok single line: '2343'

Test #2:

score: 0
Accepted
time: 48ms
memory: 14968kb

input:

500000
499999
499999
499999
499998
499998
499998
499997
499997
499996
499996
499995
499995
499995
499995
499995
499994
499993
499993
499993
499993
499993
499991
499990
499989
499989
499989
499989
499988
499987
499987
499987
499986
499986
499986
499985
499984
499984
499983
499983
499983
499982
499982...

output:

120796176110187798

result:

ok single line: '120796176110187798'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

10
931
837
766
745
633
604
567
487
482
453
430
412
364
323
275
262
220
137
121
51

output:

8081182

result:

ok single line: '8081182'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

25
985
973
942
914
894
887
883
865
825
815
807
807
792
766
763
714
675
649
630
586
573
570
566
561
546
538
520
515
510
501
493
433
418
416
406
404
381
343
334
281
264
219
213
194
193
179
151
111
77
76

output:

25870330

result:

ok single line: '25870330'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

50
1995
1978
1949
1945
1913
1873
1856
1837
1826
1804
1766
1757
1749
1749
1646
1641
1594
1561
1548
1540
1497
1490
1476
1469
1458
1446
1424
1401
1379
1370
1328
1327
1308
1297
1275
1254
1193
1182
1150
1139
1136
1134
1128
1125
1111
1108
1092
1080
1052
1041
1039
1038
975
949
941
937
921
853
803
797
780
7...

output:

184222136

result:

ok single line: '184222136'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

250
999
999
998
997
997
997
996
994
994
993
993
988
984
981
981
981
979
977
975
972
971
970
968
965
965
961
960
957
955
955
950
949
946
945
942
941
938
937
937
932
931
930
930
928
926
925
924
920
917
917
917
912
912
911
907
906
904
901
900
898
898
897
895
892
890
889
888
886
886
883
882
881
881
873
...

output:

236493796

result:

ok single line: '236493796'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

500
199
199
199
199
199
198
198
197
197
197
197
197
195
195
195
195
195
195
195
195
195
195
194
194
194
194
194
193
193
192
192
192
192
192
192
192
191
191
191
191
191
191
191
190
190
190
190
190
190
190
190
189
189
189
189
188
188
188
188
187
187
187
187
187
186
186
186
186
185
185
185
185
185
185
...

output:

18904170

result:

ok single line: '18904170'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

5000
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199
199...

output:

290384048

result:

ok single line: '290384048'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

35000
4999
4999
4999
4999
4999
4999
4999
4999
4999
4999
4999
4999
4999
4998
4998
4998
4998
4998
4998
4998
4998
4998
4998
4998
4998
4997
4997
4997
4997
4997
4997
4997
4997
4997
4997
4997
4997
4997
4997
4997
4997
4997
4996
4996
4996
4996
4996
4996
4996
4996
4996
4996
4996
4996
4996
4996
4996
4996
4996...

output:

862060840375

result:

ok single line: '862060840375'

Test #10:

score: 0
Accepted
time: 5ms
memory: 5404kb

input:

100000
199999
199999
199997
199996
199994
199992
199991
199990
199990
199989
199988
199988
199986
199984
199983
199982
199982
199981
199981
199980
199980
199979
199978
199974
199973
199972
199971
199969
199968
199967
199963
199962
199961
199961
199961
199960
199959
199957
199957
199956
199955
199954...

output:

4063450689734560

result:

ok single line: '4063450689734560'