QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#141539#2133. NativesAnwar_Gehad_Maghraby#AC ✓1ms3644kbC++23457b2023-08-17 16:09:532023-08-17 16:09:55

Judging History

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

  • [2023-08-17 16:09:55]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3644kb
  • [2023-08-17 16:09:53]
  • 提交

answer

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


const int N = 2e5 + 4;

int main() {
    cin.tie(0);cin.sync_with_stdio(0);
    cout.tie(0);cout.sync_with_stdio(0);

    int n ;
    cin >> n ;

    long long a[n] ;
    for (int i = 0; i < n; ++i) {
        cin >> a[i] ;
    }

    sort(a,a+n) ;
    reverse(a,a+n) ;

    long long ans =0 ;

    for (int i = 0; i < n/2 ; ++i) {
        ans += a[i] ;
    }

    cout << ans ;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
2 4 1 3 3 5

output:

12

result:

ok 1 number(s): "12"

Test #2:

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

input:

2
1 1

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

2
1000 1

output:

1000

result:

ok 1 number(s): "1000"

Test #4:

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

input:

5
1 1 2 2 3

output:

5

result:

ok 1 number(s): "5"

Test #5:

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

input:

7
1 1 1 2 2 3 3

output:

8

result:

ok 1 number(s): "8"

Test #6:

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

input:

1000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

500

result:

ok 1 number(s): "500"

Test #7:

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

input:

1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

500000

result:

ok 1 number(s): "500000"

Test #8:

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

input:

1000
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...

output:

1000

result:

ok 1 number(s): "1000"

Test #9:

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

input:

1000
1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1...

output:

500000

result:

ok 1 number(s): "500000"

Test #10:

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

input:

999
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 ...

output:

1331

result:

ok 1 number(s): "1331"

Test #11:

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

input:

996
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 ...

output:

1328

result:

ok 1 number(s): "1328"

Test #12:

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

input:

10
1 1 1 1 1 1 1 1 1 1

output:

5

result:

ok 1 number(s): "5"

Test #13:

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

input:

10
2 2 2 1 1 2 2 2 2 1

output:

10

result:

ok 1 number(s): "10"

Test #14:

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

input:

10
187 736 359 818 228 252 846 857 195 521

output:

3778

result:

ok 1 number(s): "3778"

Test #15:

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

input:

73
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

36

result:

ok 1 number(s): "36"

Test #16:

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

input:

73
1 1 1 1 2 1 2 2 2 1 1 1 2 1 2 2 2 1 2 1 1 2 1 1 1 2 1 2 2 2 2 1 1 2 2 1 2 2 2 1 1 2 2 2 1 2 2 1 2 2 1 1 2 1 1 1 1 2 2 2 1 2 1 1 1 2 1 2 1 1 1 1 1

output:

70

result:

ok 1 number(s): "70"

Test #17:

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

input:

73
138 128 426 138 281 902 599 102 540 128 283 825 662 270 193 372 590 439 596 736 763 201 109 660 26 718 755 727 395 181 283 634 279 437 303 881 623 537 627 942 612 90 414 518 799 56 810 910 854 855 546 992 394 736 725 957 354 35 596 67 933 782 225 919 964 527 746 10 590 530 162 208 563

output:

27129

result:

ok 1 number(s): "27129"

Test #18:

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

input:

100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

50

result:

ok 1 number(s): "50"

Test #19:

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

input:

100
2 2 2 2 1 2 2 2 1 1 2 1 1 2 2 2 1 2 2 1 1 1 2 1 2 1 1 1 1 1 2 2 1 2 1 2 2 2 1 2 1 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 2 2 1 2 1 1 1 1 1 2 2 1 1 2 1 1 2 2 2 1 1 1 1 2 1 2 2 1 2 2 1 2 2 1 2 2 2 2 1 1 1 2

output:

98

result:

ok 1 number(s): "98"

Test #20:

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

input:

100
145 78 461 312 926 863 465 330 997 840 97 722 57 372 882 931 218 752 775 353 469 433 237 940 230 230 718 653 30 298 728 894 836 857 558 83 169 556 229 81 120 290 772 394 303 194 12 818 660 123 26 783 987 845 113 27 779 464 24 788 481 884 363 914 632 779 864 275 580 344 534 904 808 892 333 607 58...

output:

38525

result:

ok 1 number(s): "38525"

Test #21:

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

input:

999
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

499

result:

ok 1 number(s): "499"

Test #22:

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

input:

999
1 2 1 2 1 2 1 2 1 2 1 2 2 1 2 2 2 2 2 2 2 1 1 2 1 1 1 2 1 1 2 1 2 1 2 2 1 1 2 1 2 1 1 1 1 1 1 2 1 1 2 2 2 2 1 1 1 2 1 2 2 2 2 2 2 1 1 2 1 2 2 1 1 1 1 1 1 2 1 2 1 1 2 1 2 2 1 2 2 1 1 1 1 1 2 2 2 1 1 2 2 2 2 1 2 1 2 1 2 1 2 2 1 2 1 1 1 1 1 2 1 2 1 1 2 1 2 2 2 2 1 1 1 1 1 1 2 2 2 2 1 2 2 2 1 1 1 1 ...

output:

978

result:

ok 1 number(s): "978"

Test #23:

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

input:

999
40 973 861 582 714 647 273 340 747 29 509 912 115 256 130 139 917 518 278 77 490 830 725 672 913 76 942 64 755 725 869 120 953 422 24 411 381 165 463 277 93 744 945 973 197 122 837 829 470 296 228 406 607 648 78 168 122 875 663 243 425 149 323 497 346 882 428 832 31 778 619 797 606 340 234 944 8...

output:

374188

result:

ok 1 number(s): "374188"

Test #24:

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

input:

1000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

500

result:

ok 1 number(s): "500"

Test #25:

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

input:

1000
1 2 2 1 2 1 2 1 1 2 2 1 2 1 1 2 2 2 1 1 1 1 1 2 1 1 2 1 1 1 2 1 2 2 2 2 1 1 2 2 2 1 2 1 1 2 2 1 2 1 2 1 2 2 1 2 2 1 2 1 2 1 2 1 2 2 2 2 1 1 1 2 1 2 2 2 1 1 1 1 2 1 1 2 1 2 1 1 1 2 1 1 2 2 1 1 2 1 2 1 1 2 2 2 2 2 2 1 1 2 1 1 1 1 1 2 2 2 1 2 1 2 1 1 2 1 1 1 2 2 2 1 1 2 2 1 1 1 2 2 2 1 2 2 1 1 1 2...

output:

1000

result:

ok 1 number(s): "1000"

Test #26:

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

input:

1000
783 658 65 804 841 25 133 857 609 625 136 485 282 828 175 706 986 516 654 393 257 963 863 325 284 759 101 321 949 291 341 113 930 566 210 619 250 614 668 323 790 495 524 202 890 54 14 584 928 970 522 744 317 57 906 749 125 263 588 951 687 638 540 469 586 900 415 648 721 17 141 411 244 180 593 6...

output:

375729

result:

ok 1 number(s): "375729"