QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#281285#7843. Delivery Forceswnmrmr#AC ✓121ms19340kbC++20765b2023-12-10 01:58:092023-12-10 01:58:09

Judging History

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

  • [2023-12-10 01:58:09]
  • 评测
  • 测评结果:AC
  • 用时:121ms
  • 内存:19340kb
  • [2023-12-10 01:58:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define F first
#define S second
#define ll long long
#define ld long double
#define sz(x) (int)x.size()
#define MAXN  10000000
 
#include <bits/stdc++.h>
using namespace std;


void solve(){
    ll n; cin >> n;
    vector <ll> v(n);
    for(auto &x : v) cin >> x;
    sort(v.begin(), v.end());
    deque <ll> d;
    for(int i =0; i < n; i++){
        d.push_front(v[i]);    
    }
    ll ans = 0;
    for(int j = 0; j < n/3; j++){
        d.pop_front();
        d.pop_back();
        ans += d.front();
        d.pop_front();
    }
    cout << ans;
}

signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	//int t; cin>>t; while(t--)
	solve();
 
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3612kb

input:

3
1 2 3

output:

2

result:

ok single line: '2'

Test #2:

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

input:

6
5 6 2 3 1 4

output:

8

result:

ok single line: '8'

Test #3:

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

input:

9
2 6 3 9 7 4 3 3 8

output:

17

result:

ok single line: '17'

Test #4:

score: 0
Accepted
time: 116ms
memory: 19220kb

input:

999999
766215 713129 551905 26477 394429 38270 323358 169906 134399 27212 592253 393932 784669 231406 670086 161895 170373 200301 820284 399513 997129 346324 634336 514417 694071 485811 363428 44301 340537 911474 168896 329130 523456 877443 700589 499969 765879 53627 808883 878775 729503 480197 9869...

output:

222210132642

result:

ok single line: '222210132642'

Test #5:

score: 0
Accepted
time: 113ms
memory: 19340kb

input:

999999
735430 394203 76727 673855 938257 729268 671652 400799 141537 427959 871228 523018 10443 831539 169600 740061 858409 811601 910623 383208 306214 142004 801383 145741 317544 333289 532934 642507 379433 480069 676708 387405 244592 917435 569297 641538 595528 668700 277146 430228 861959 600190 2...

output:

222128779454

result:

ok single line: '222128779454'

Test #6:

score: 0
Accepted
time: 61ms
memory: 19168kb

input:

999999
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...

output:

333333000000

result:

ok single line: '333333000000'

Test #7:

score: 0
Accepted
time: 121ms
memory: 19152kb

input:

999999
78401 547321 535742 563831 121028 979230 157528 617305 174545 881305 95453 711930 427827 65872 498863 521351 876733 290929 719333 421452 511027 821679 569186 477481 97103 719367 152031 682069 675642 936448 557757 505742 969863 467851 65015 77928 929602 256124 231653 120969 877091 909310 14852...

output:

222221777778

result:

ok single line: '222221777778'

Test #8:

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

input:

9
15 7 12 15 8 13 3 6 5

output:

34

result:

ok single line: '34'

Test #9:

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

input:

999
3 1 4 1 2 3 2 4 2 1 3 5 5 3 5 2 3 4 3 3 3 4 1 2 4 3 1 5 1 1 1 5 4 4 1 1 3 3 4 4 2 2 4 4 4 1 1 5 1 4 3 2 2 1 2 4 1 4 2 2 3 2 2 4 4 3 3 3 5 3 4 5 3 4 3 2 3 5 3 4 3 1 3 5 4 3 1 3 2 2 3 1 2 4 1 5 4 4 1 1 4 2 5 3 3 1 4 1 5 5 4 1 4 1 2 1 5 4 3 1 5 2 5 2 1 4 3 2 3 2 1 3 1 3 1 4 1 5 4 5 3 5 4 1 3 2 4 5 ...

output:

1254

result:

ok single line: '1254'

Test #10:

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

input:

999
32 23 43 41 38 49 6 2 45 45 40 44 16 19 16 28 15 45 11 41 34 25 44 41 36 22 26 13 48 33 22 2 45 20 49 30 13 34 13 17 38 28 10 26 27 39 10 41 7 23 41 19 49 11 18 10 2 38 18 40 21 38 38 21 30 31 11 24 23 37 46 29 39 17 10 44 5 1 45 28 12 16 23 24 32 50 21 16 26 23 47 36 19 40 33 35 29 33 22 38 38 ...

output:

11386

result:

ok single line: '11386'

Test #11:

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

input:

999
197820 260852 951386 255067 314902 237423 216770 871195 512774 307192 186862 217128 638859 698819 372748 461434 764651 336076 908010 697976 879639 747566 150753 483029 504898 322170 404530 647683 419314 736979 175853 687216 775921 752146 480081 984369 938276 595614 71077 234888 835373 97846 1510...

output:

220207732

result:

ok single line: '220207732'

Test #12:

score: 0
Accepted
time: 50ms
memory: 19124kb

input:

999999
9 9 8 3 3 10 10 6 2 2 10 7 1 8 10 6 5 9 2 2 5 7 2 9 4 9 1 4 2 7 9 10 10 9 4 2 7 8 9 6 4 9 6 8 2 7 9 8 10 7 5 10 2 8 1 10 5 2 4 8 6 3 2 1 2 5 10 5 10 6 7 4 5 10 6 2 10 8 4 6 4 5 3 6 5 1 3 6 3 4 8 8 10 8 9 7 5 6 7 5 1 6 3 9 1 1 6 2 3 5 7 9 7 5 5 8 7 9 4 8 9 3 3 5 10 4 3 2 5 5 2 3 4 4 7 7 2 4 1 ...

output:

2383465

result:

ok single line: '2383465'

Test #13:

score: 0
Accepted
time: 62ms
memory: 19172kb

input:

999999
29 51 49 53 1 56 28 1 100 91 77 91 14 79 65 15 32 72 74 69 4 26 20 92 69 48 17 10 11 24 29 80 61 19 40 82 65 96 76 18 12 46 7 54 97 33 86 81 1 48 44 32 61 79 39 10 5 33 43 81 98 48 51 60 35 54 64 72 71 76 75 28 22 26 44 66 38 37 19 71 97 69 77 21 34 44 18 79 30 2 87 3 9 25 79 12 63 15 53 69 6...

output:

22372714

result:

ok single line: '22372714'

Test #14:

score: 0
Accepted
time: 90ms
memory: 19196kb

input:

999999
2032 4631 1456 5040 9108 8799 9113 5433 3669 2368 3085 9066 1283 2833 2495 7593 7533 9159 8676 6983 6677 2267 8646 4520 2982 5164 9938 6394 982 8432 487 5618 7545 923 2949 6325 26 5013 3819 9380 5636 1179 3201 328 3770 7405 1138 3855 9269 4790 9814 4755 7173 5376 2162 2495 677 7290 6252 5765 ...

output:

2221075594

result:

ok single line: '2221075594'

Test #15:

score: 0
Accepted
time: 115ms
memory: 19184kb

input:

999999
806818 817863 118843 31107 503329 983941 140868 5365 239957 647550 641739 769487 296575 721524 629114 376722 28768 789783 951437 379891 7464 632692 657198 514958 788690 955607 772830 585409 848829 110624 636448 719260 89519 583702 477576 528786 799685 777678 268627 283324 987315 475579 540536...

output:

222295077778

result:

ok single line: '222295077778'