QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#55450 | #2962. Election Paradox | MahmoudAtia# | AC ✓ | 2ms | 3744kb | C++ | 961b | 2022-10-13 19:51:08 | 2022-10-13 19:51:08 |
Judging History
answer
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, -1, 0, 1, -1, 1};
int dj[] = {1, 1, 0, -1, -1, 0, 1, -1};
const ll oo = 1e18, MOD = 998244353;
const int N = 1e4 + 5, M = 350;
const ld PI = acos(-1.0), EPS = 1e-9;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int n, a[N];
//#define endl '\n'
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//freopen("farm.in", "r", stdin);
//memset(dp, -1, sizeof dp);
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
reverse(a, a + n);
int ans = 0;
for (int i = 0; i < n / 2; i++) ans += a[i];
for (int i = n / 2; i < n; i++) ans += a[i] / 2;
cout << ans;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3600kb
input:
3 11 3 3
output:
13
result:
ok single line: '13'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
3 497 329 755
output:
1167
result:
ok single line: '1167'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3636kb
input:
3 1 1 1
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3584kb
input:
3 999 999 999
output:
1997
result:
ok single line: '1997'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
3 5 3 1
output:
6
result:
ok single line: '6'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3744kb
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: 3468kb
input:
9 1 1 1 1 1 1 1 1 1
output:
4
result:
ok single line: '4'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3564kb
input:
9 999 999 999 999 999 999 999 999 999
output:
6491
result:
ok single line: '6491'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
9 17 9 5 15 3 1 7 11 13
output:
66
result:
ok single line: '66'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3640kb
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: 2ms
memory: 3612kb
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: 2ms
memory: 3600kb
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: 2ms
memory: 3600kb
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: 2ms
memory: 3608kb
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: 2ms
memory: 3612kb
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: 2ms
memory: 3592kb
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: 1ms
memory: 3588kb
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: 2ms
memory: 3652kb
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: 2ms
memory: 3476kb
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: 2ms
memory: 3616kb
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: 2ms
memory: 3588kb
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'