QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#424485#2962. Election ParadoxTheSleepyDevil#AC ✓0ms3844kbC++201.7kb2024-05-29 11:14:362024-05-29 11:14:37

Judging History

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

  • [2024-05-29 11:14:37]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3844kb
  • [2024-05-29 11:14:36]
  • 提交

answer

/*
     Hell, 'til I reach Hell, I ain't scared
     Mama checkin' in my bedroom, I ain't there
                                                */
    #include<bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    using namespace std;

    #define Major  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define TxtIO   freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    #define read(a,n) for(int i = 0 ; i<n ; i++) cin>>a[i];
    #define write(a) for(auto x : a) cout<<x<<" ";
    #define int long long
    #define pb push_back
    #define all(a)  a.begin(),a.end()
    #define el "\n"

    typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

    const int inf=4e18;

    int dx[]={1,0,-1,0,1,1,-1,-1};
    int dy[]={0,1,0,-1,1,-1,1,-1};

    const int mod=1e9+7;
    const int MAX =1e6+7;

   // ---------------------------Function----------------------------------//

    void TestCake(){
       int n;cin>>n;
       vector<int>arr(n);
       read(arr,n);
       sort(all(arr));
       reverse(all(arr));
       int ans=0;
       for(int i=0;i<n/2;i++){
          ans+=arr[i];
       }
       for(int i=n/2;i<n;i++){
           ans+=(arr[i]/2);
       }
       cout<<ans;
    }
    //------------------------------Main---------------------------//
    signed main(){
        Major
        int T = 1;
//        cin >> T;
        while(T--){
            TestCake();
        //       cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
        }
        return 0;
    }

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
11 3 3

output:

13

result:

ok single line: '13'

Test #2:

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

input:

3
497 329 755

output:

1167

result:

ok single line: '1167'

Test #3:

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

input:

3
1 1 1

output:

1

result:

ok single line: '1'

Test #4:

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

input:

3
999 999 999

output:

1997

result:

ok single line: '1997'

Test #5:

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

input:

3
5 3 1

output:

6

result:

ok single line: '6'

Test #6:

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

input:

9
887 223 533 713 979 343 669 337 555

output:

4241

result:

ok single line: '4241'

Test #7:

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

input:

9
1 1 1 1 1 1 1 1 1

output:

4

result:

ok single line: '4'

Test #8:

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

input:

9
999 999 999 999 999 999 999 999 999

output:

6491

result:

ok single line: '6491'

Test #9:

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

input:

9
17 9 5 15 3 1 7 11 13

output:

66

result:

ok single line: '66'

Test #10:

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

input:

31
25 715 445 703 11 673 113 641 11 195 637 923 475 519 245 187 433 787 797 687 1 357 763 935 287 539 15 179 317 655 423

output:

12063

result:

ok single line: '12063'

Test #11:

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

input:

31
1 1 1 1 1 1 1 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:

15

result:

ok single line: '15'

Test #12:

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

input:

31
999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999

output:

22969

result:

ok single line: '22969'

Test #13:

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

input:

31
7 27 3 33 39 61 41 47 19 43 53 15 23 59 49 37 13 35 45 57 25 21 9 31 55 5 17 29 1 51 11

output:

825

result:

ok single line: '825'

Test #14:

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

input:

99
537 941 157 3 429 919 461 99 569 719 905 643 21 821 349 757 405 49 275 751 519 341 523 129 33 421 399 511 541 453 703 393 761 697 241 839 835 359 745 593 647 501 515 351 431 39 487 89 29 435 27 597 159 91 605 915 653 479 183 573 713 61 683 745 249 719 917 299 981 147 857 27 213 653 871 887 607 16...

output:

40515

result:

ok single line: '40515'

Test #15:

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

input:

99
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

49

result:

ok single line: '49'

Test #16:

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

input:

99
999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 9...

output:

73901

result:

ok single line: '73901'

Test #17:

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

input:

99
9 27 79 195 163 189 73 197 45 181 61 33 75 25 93 89 187 173 47 15 111 87 77 35 159 153 139 37 149 57 109 151 113 43 169 55 101 71 39 51 117 19 3 17 121 145 115 21 99 83 155 41 31 161 191 23 133 137 63 91 103 119 53 157 81 123 125 49 167 107 183 85 141 135 29 147 67 171 185 97 175 179 105 11 7 165...

output:

8526

result:

ok single line: '8526'

Test #18:

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

input:

999
743 57 1 513 11 709 521 125 199 665 901 93 367 391 981 259 407 119 39 291 603 89 853 729 747 527 363 659 19 275 845 779 933 29 629 179 535 987 663 595 91 167 217 415 783 33 45 869 181 607 743 321 435 907 999 991 911 785 115 949 555 897 743 571 929 397 467 295 243 443 545 863 589 973 893 693 81 6...

output:

446367

result:

ok single line: '446367'

Test #19:

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

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 single line: '499'

Test #20:

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

input:

999
999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 999 ...

output:

748001

result:

ok single line: '748001'

Test #21:

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

input:

999
825 193 105 87 335 603 129 825 529 835 155 83 873 319 901 857 487 571 235 701 697 989 253 751 585 733 473 55 947 715 995 683 403 279 325 351 355 55 943 519 75 435 5 703 755 177 161 547 275 279 489 557 813 21 201 871 255 955 881 337 559 411 675 927 401 389 173 829 955 169 535 659 615 693 883 175 ...

output:

436251

result:

ok single line: '436251'