QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#467268 | #6443. Windblume Festival | Texcavator | AC ✓ | 157ms | 11180kb | C++20 | 965b | 2024-07-08 15:28:32 | 2024-07-08 15:28:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
using i64 = long long;
typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;
const int N = 10;
const int maxn = 1e6 + 10;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;
void solve()
{
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i ++ ) cin >> a[i];
sort(a.begin() + 1, a.end());
int ans = 0;
for (int i = 1; i <= n; i ++ )
{
if (i == n) ans += a[i];
else if (i == 1) ans -= a[i];
else ans += abs(a[i]);
}
cout << ans << '\n';
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t = 1;
cin >> t;
while (t--)
{
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
5 4 1 -3 2 -4 11 91 66 73 71 32 83 72 79 84 33 93 12 91 66 73 71 32 83 72 79 84 33 33 93 13 91 66 73 71 32 83 72 79 84 33 33 33 93 1 0
output:
10 713 746 779 0
result:
ok 5 number(s): "10 713 746 779 0"
Test #2:
score: 0
Accepted
time: 126ms
memory: 3788kb
input:
1000000 1 2 1 -2 1 1 1 -1 1 2 1 1 1 2 1 -2 1 -2 1 2 1 1 1 1 1 2 1 2 1 2 1 -2 1 -2 1 0 1 2 1 1 1 -1 1 0 1 -2 1 0 1 1 1 1 1 -2 1 -2 1 2 1 1 1 2 1 1 1 1 1 0 1 2 1 0 1 -1 1 -1 1 -2 1 -2 1 0 1 -2 1 0 1 1 1 -1 1 2 1 0 1 -2 1 -2 1 0 1 1 1 -1 1 -2 1 -1 1 0 1 -1 1 -1 1 -1 1 -1 1 1 1 2 1 0 1 0 1 -2 1 2 1 2 1 ...
output:
2 -2 1 -1 2 1 2 -2 -2 2 1 1 2 2 2 -2 -2 0 2 1 -1 0 -2 0 1 1 -2 -2 2 1 2 1 1 0 2 0 -1 -1 -2 -2 0 -2 0 1 -1 2 0 -2 -2 0 1 -1 -2 -1 0 -1 -1 -1 -1 1 2 0 0 -2 2 2 -1 2 -2 -1 -2 -1 -2 2 -1 -1 0 -2 0 0 0 1 1 2 1 -1 0 -2 1 2 1 1 0 1 2 -2 -1 -1 0 -2 2 2 1 0 -1 0 -1 0 1 -2 2 1 -2 -2 0 -1 1 -1 2 -2 2 1 1 2 0 2...
result:
ok 1000000 numbers
Test #3:
score: 0
Accepted
time: 157ms
memory: 3660kb
input:
1000000 1 -182188011 1 -889401027 1 -379434063 1 -731536137 1 632523155 1 837208235 1 192807861 1 -162604370 1 963735146 1 736725265 1 -70315400 1 659481275 1 217883785 1 -396219883 1 653358757 1 -489133046 1 412498823 1 -210628961 1 -137310415 1 849916587 1 -50143945 1 -509463528 1 105005776 1 7382...
output:
-182188011 -889401027 -379434063 -731536137 632523155 837208235 192807861 -162604370 963735146 736725265 -70315400 659481275 217883785 -396219883 653358757 -489133046 412498823 -210628961 -137310415 849916587 -50143945 -509463528 105005776 738262345 352827098 391146170 108054338 601933024 -705538291...
result:
ok 1000000 numbers
Test #4:
score: 0
Accepted
time: 97ms
memory: 3560kb
input:
666685 1 0 2 2 -1 1 2 1 2 1 -1 2 -2 2 1 0 2 -1 -2 2 2 -1 2 0 1 2 2 -1 1 1 2 1 1 1 1 2 0 2 2 1 0 2 0 2 2 -1 2 1 1 1 -1 1 -2 1 2 2 -1 0 2 -2 1 2 -2 -2 2 0 -1 1 -2 1 2 1 2 2 -1 -1 1 1 1 -2 1 2 2 -2 1 2 2 1 2 0 -2 1 -1 1 0 1 2 1 -2 2 2 0 1 -1 2 0 0 2 2 -2 2 -2 0 1 -2 1 1 2 2 0 1 -2 1 -1 2 1 -1 2 1 -2 2 ...
output:
0 3 2 2 -1 4 0 1 3 1 3 1 0 1 2 1 2 3 1 -1 -2 2 1 3 0 1 -2 2 2 0 1 -2 2 3 1 2 -1 0 2 -2 2 -1 0 4 2 -2 1 2 -2 -1 2 3 2 -2 3 4 2 2 -2 1 2 3 3 2 2 2 0 -2 2 1 1 0 2 -1 2 0 0 2 1 2 4 1 1 4 -2 -1 3 1 0 1 1 0 -2 2 1 2 2 1 2 -2 0 2 2 1 2 -1 0 -2 0 -1 2 0 3 1 0 -1 0 1 2 0 -1 1 -1 2 0 1 -1 -1 -2 1 0 2 1 -2 2 2...
result:
ok 666685 numbers
Test #5:
score: 0
Accepted
time: 133ms
memory: 3600kb
input:
666588 1 877229937 1 -790704201 2 932859032 656440170 1 -192529503 2 94528196 817385616 1 13901525 1 340254741 1 -685072067 2 549059935 448603339 2 675680588 -933313073 2 370439701 -907173091 2 -602257809 -804844783 2 627233219 -171938196 1 -643067959 2 -525280817 -454814822 1 557964767 1 -667401143...
output:
877229937 -790704201 276418862 -192529503 722857420 13901525 340254741 -685072067 100456596 1608993661 1277612792 202586974 799171415 -643067959 70465995 557964767 -667401143 212380490 596566747 41930382 -581445120 613463693 -594232733 -641051872 1766315648 143281260 1111011274 -534042370 854561349 ...
result:
ok 666588 numbers
Test #6:
score: 0
Accepted
time: 86ms
memory: 3564kb
input:
499844 3 -1 -1 -2 2 1 1 1 1 3 2 1 2 1 1 3 1 2 -2 1 -1 3 2 2 2 1 -2 3 -2 -2 -1 3 1 -1 -2 3 -2 1 2 1 2 2 0 0 1 -1 2 -2 0 3 -1 -1 0 1 2 3 2 -1 -1 2 -2 1 2 2 2 1 0 3 0 2 -1 3 0 0 0 1 -2 1 -2 3 2 1 2 2 -2 2 2 0 -1 2 0 -2 1 -2 1 1 2 -1 1 2 -2 2 3 2 2 -2 3 -2 -2 -1 1 -2 1 2 3 -2 -2 1 1 2 2 2 1 3 -1 0 2 3 0...
output:
2 0 1 3 1 5 -1 2 -2 3 4 5 2 0 -1 2 2 2 4 3 0 0 3 0 -2 -2 3 4 1 2 -2 1 2 4 6 3 -2 2 5 2 1 3 3 2 5 -1 6 1 3 3 -1 4 1 -2 2 0 0 3 2 3 0 5 5 -2 3 1 0 4 -2 2 1 0 1 2 4 4 -1 5 3 1 -2 1 5 2 3 0 1 4 5 0 2 0 0 0 0 0 2 4 -1 3 4 0 0 1 2 4 6 2 5 4 3 2 2 -1 -2 2 4 1 1 0 1 4 5 3 1 5 6 3 3 1 1 2 4 2 0 4 1 2 -1 2 -1...
result:
ok 499844 numbers
Test #7:
score: 0
Accepted
time: 124ms
memory: 3660kb
input:
499691 1 -454675368 2 264013077 -238869020 1 575599266 3 274155860 -497922351 -150216398 2 -6591153 -257069280 3 226388169 -230539114 -803058563 2 275005873 138256575 1 81300507 3 601832779 70476469 454852039 3 -74797562 -372577604 -695936494 2 866129756 -978486310 2 -538645107 370694934 2 -44723359...
output:
-454675368 502882097 575599266 922294609 250478127 1259985846 136749298 81300507 986208349 993716536 1844616066 909340041 1360174143 470598434 1079525140 2337391098 549629894 -512440192 737996691 -327312313 -436231142 102096468 900115744 503570852 989296986 1056237684 406297428 -448187704 1532940120...
result:
ok 499691 numbers
Test #8:
score: 0
Accepted
time: 74ms
memory: 3616kb
input:
333544 3 -1 -2 0 3 -2 -1 -2 1 1 1 -1 1 2 1 -2 3 2 0 -1 4 -1 -2 -2 1 4 -1 -2 1 1 3 -2 -2 1 2 -1 -1 1 0 2 -1 1 5 0 2 1 0 -1 5 -2 1 -1 2 0 4 -2 -2 0 1 4 1 -2 2 1 2 -2 2 1 2 2 0 1 4 -2 1 -2 0 4 0 -1 2 2 2 -1 -1 2 1 -1 1 1 3 0 2 -2 1 -1 4 -2 2 -2 2 4 0 2 2 0 4 -2 -2 -1 1 5 -1 1 2 2 -2 1 1 3 -1 1 -1 5 2 -...
output:
3 3 1 -1 2 -2 3 6 5 5 0 0 2 4 6 5 6 4 2 1 5 5 0 2 1 4 -1 8 4 6 8 1 3 7 3 2 8 2 6 1 3 4 6 4 3 3 6 5 6 6 4 4 1 -1 8 0 4 -1 5 8 3 5 1 1 4 10 5 6 4 4 1 5 7 3 4 4 3 3 5 2 2 5 2 -2 4 4 5 4 2 5 0 5 3 8 2 4 5 5 7 5 0 7 1 3 1 6 4 3 2 3 -1 8 -1 -2 4 5 2 2 2 3 0 3 5 2 1 7 4 7 5 3 2 5 3 1 1 3 2 6 5 5 2 7 3 2 4 ...
result:
ok 333544 numbers
Test #9:
score: 0
Accepted
time: 115ms
memory: 3624kb
input:
333513 4 582559744 -799178064 571530607 794345345 5 -444670684 478007664 -100997531 -665638785 -255616061 5 920410947 51089331 798332171 803997323 -133307368 3 -293426140 -20963682 -572717734 3 584637918 -798828574 -560174108 4 690936036 -206214791 883313817 -203766443 4 -208459648 499341550 -536132...
output:
2747613760 1944930725 2707137140 845180192 1943640600 1984231087 2239398814 2552338240 1738267329 985815745 1183500701 898920895 1854108187 515552701 535642173 -208590082 -685820668 545513412 74372812 682252364 127108289 2293185714 2772852939 2317987507 222343613 191784340 1736346894 2510109205 5086...
result:
ok 333513 numbers
Test #10:
score: 0
Accepted
time: 64ms
memory: 3632kb
input:
181705 1 1 5 2 1 1 1 -1 6 -2 2 2 -1 -1 -2 3 1 2 2 6 2 -2 1 2 0 2 7 -2 -2 1 0 0 2 -1 4 0 1 2 2 7 -2 -2 0 1 0 2 0 10 2 -2 2 1 0 -2 1 2 -1 1 9 1 2 0 -1 -1 0 1 2 2 2 -1 -2 9 1 -1 0 1 1 -1 -1 1 0 10 0 -1 -1 1 -2 -1 1 0 -2 2 10 -2 1 2 -1 0 1 2 -2 -2 0 10 0 -2 -2 1 -2 2 -2 0 2 2 4 0 -2 1 2 9 2 -2 -1 -1 -2 ...
output:
1 6 10 3 9 8 5 7 14 10 1 7 11 13 15 5 13 2 2 5 7 -2 7 1 4 13 6 1 13 11 10 0 3 6 8 6 6 5 2 1 8 0 1 13 12 11 8 10 8 1 2 10 10 2 8 7 5 8 5 -2 7 5 11 5 7 3 9 4 5 13 16 2 10 6 11 10 -1 4 14 9 7 7 13 6 11 10 4 1 12 8 9 13 13 11 16 4 2 1 1 4 3 10 0 1 2 6 11 14 -1 9 10 5 5 4 4 14 9 -2 10 0 1 9 -1 0 12 6 3 7...
result:
ok 181705 numbers
Test #11:
score: 0
Accepted
time: 96ms
memory: 3532kb
input:
181878 10 950854126 132493202 -165676506 987075802 455883949 -256774666 708446609 283729963 909732599 -471619957 9 309556933 335687252 -235709089 596094907 -370099118 180190303 -631880509 -958132089 513613552 9 -650742923 -850567627 41909851 429536269 902994239 -945061879 957564315 507628671 2514982...
output:
5322287379 4130963752 5537504047 2007467508 2559314591 5556713372 899719606 4490808159 2996720607 2015528098 4247255746 1161294169 4613145629 180300727 378704234 1732712178 4707351533 3845637791 3244044051 -429229295 3147717225 2766987222 5689049680 5827633413 649506049 2311101802 835818530 26438791...
result:
ok 181878 numbers
Test #12:
score: 0
Accepted
time: 54ms
memory: 3532kb
input:
19758 93 2 -1 -2 1 -2 1 -2 -2 -1 -1 0 2 0 1 0 1 -1 1 0 -2 -1 -1 -1 1 2 2 -2 1 -2 2 0 0 -2 -1 0 -2 -1 -1 -1 0 -1 1 0 -1 2 2 -1 1 2 2 2 2 -2 1 -2 0 1 -2 -1 -1 0 -1 2 1 -2 -2 -1 -1 -2 -1 2 -1 -1 1 1 1 2 -1 1 -2 2 1 -2 -2 2 0 2 1 -1 1 -2 -2 -1 75 0 0 1 0 1 2 -2 -1 0 0 2 2 -1 2 2 0 0 -2 2 -1 -2 1 0 0 -1 ...
output:
118 83 64 99 119 80 101 118 35 5 113 88 19 84 103 119 10 92 40 104 64 66 4 79 39 50 23 17 29 78 36 64 24 114 124 63 14 64 4 47 65 76 87 89 112 72 104 7 76 55 98 53 29 73 96 96 59 42 14 104 36 60 64 36 117 100 91 69 104 86 88 20 66 46 45 42 36 4 95 9 39 86 55 52 6 22 100 109 12 63 97 108 69 92 111 12...
result:
ok 19758 numbers
Test #13:
score: 0
Accepted
time: 87ms
memory: 3616kb
input:
19823 95 585801099 143363497 -922935868 -374723459 -260323970 -260770296 501688472 -825806604 836453465 670302 162662827 -379594255 168917914 912768962 291952063 835733143 -66252948 -163744368 -558080636 -232854407 454378736 882030915 -145535109 926403894 439933396 -901652332 212021902 173633011 627...
output:
42530982138 35218285359 43306276377 33645850707 47820215329 47326371206 37201662571 8437700064 1709472275 25631628146 47666010041 10243050533 40605302215 40044237117 11768681657 20108317998 4752224478 36096056485 40708898518 15587629897 47496863369 30434252100 16010142305 33907385487 21796664186 381...
result:
ok 19823 numbers
Test #14:
score: 0
Accepted
time: 51ms
memory: 3600kb
input:
2017 954 2 0 2 -2 0 -2 2 0 2 2 -1 -2 -1 -2 -2 -2 2 1 1 -2 -2 -2 2 0 2 0 -2 2 0 -2 1 0 0 1 2 -2 2 -1 -1 -2 2 0 -1 -1 -2 -2 0 -2 2 -2 -1 0 -2 -2 2 -1 0 2 -2 -2 -2 1 -2 1 0 0 -2 -1 -2 -2 -2 -1 2 2 -1 0 -1 0 -2 1 -2 2 -2 2 -1 0 -2 0 -1 -1 0 -1 1 -2 1 -2 -2 -2 1 -1 2 -2 0 -1 -2 0 0 1 2 -2 2 -2 0 -1 -1 -2...
output:
1162 678 193 28 174 653 586 1035 339 703 41 417 174 1009 958 617 416 149 394 502 437 916 834 1182 180 421 636 237 23 334 1072 714 225 1108 1032 735 255 67 264 367 171 328 590 861 460 376 892 584 376 851 500 186 106 514 1109 960 892 295 84 366 660 866 95 693 152 538 161 889 1131 771 718 530 279 1015 ...
result:
ok 2017 numbers
Test #15:
score: 0
Accepted
time: 101ms
memory: 3828kb
input:
1988 270 169408214 138907406 -546393931 -509143002 -99389783 -620355304 675165185 -843816571 179050547 -180918156 232907667 -298594001 929323189 643582857 -488306537 -909782028 -453173063 727966381 -836634939 416648332 -323954401 -434045405 -998935047 963740659 -29531400 943736694 -22070704 -8518603...
output:
136369399882 157019087982 323956343096 303317899625 486183071579 96701836135 148783835604 316425137556 70865232735 67142094682 59593805375 314155214570 393874327214 383019142165 56367300639 22092423055 266799168233 229369999192 249350344452 413016023572 409373907271 206207385395 244912753904 3796709...
result:
ok 1988 numbers
Test #16:
score: 0
Accepted
time: 51ms
memory: 3640kb
input:
189 452 -2 -1 -1 0 -2 1 2 -2 2 1 -1 -1 1 1 0 -2 -1 0 1 -2 2 0 1 1 2 2 1 -2 0 1 0 0 -2 -2 -1 -2 2 -1 0 -2 2 0 -2 1 0 -2 1 0 2 2 1 0 2 0 -1 1 2 0 1 -2 -2 0 2 -1 1 -2 0 1 -2 0 -2 0 2 0 -2 -1 -1 2 -2 2 -1 -2 -2 2 1 1 -2 2 -2 0 2 -1 -1 0 2 2 -2 -2 2 2 2 2 -1 2 -1 0 -2 0 2 0 2 1 0 2 2 -2 2 1 -1 2 0 -1 1 1...
output:
543 9514 3276 8049 8831 9204 8287 6465 3141 5836 11810 3208 8618 3842 4347 11489 11092 2161 11370 1693 8281 9520 3053 7660 5961 3518 10492 7764 7151 1628 1685 9575 9460 1913 285 10646 6644 94 7313 10421 9714 7305 7373 10449 1275 10583 1138 6459 188 7291 6556 10254 482 6098 3712 1472 906 4774 11553 1...
result:
ok 189 numbers
Test #17:
score: 0
Accepted
time: 112ms
memory: 3736kb
input:
202 5558 -371477641 243871970 -472175475 -683270158 -439975130 957568117 76992937 -406510479 460786386 574709277 -227161961 703301746 -118041270 892101427 782399152 -236582611 -556603384 -350808200 -312635122 -558881604 -658168385 427320466 -581708864 -588367681 -822305301 664880337 -644778214 43925...
output:
2782302030408 3731507948060 1747890819384 2541529633411 4911946162763 3408897642617 1810429081546 4170334981939 3424827600437 1532537028383 4531962518598 4132702954961 2504029264646 1613276512706 429205407730 2145674955251 2104733161455 1334371900551 995142000514 4882835625633 305104357245 126912714...
result:
ok 202 numbers
Test #18:
score: 0
Accepted
time: 55ms
memory: 4508kb
input:
19 49042 2 1 1 -1 1 2 -2 1 1 2 -1 2 2 -2 1 -2 0 -1 2 1 -1 0 -1 -1 2 2 -2 -1 0 1 0 0 2 2 2 0 1 1 0 2 2 -2 0 2 -2 -2 -1 -1 2 1 -2 2 -2 0 -1 -1 -1 -1 -2 -2 2 -2 0 0 2 -1 2 0 -1 2 2 0 -1 -2 -2 -2 -1 -1 -1 2 -1 -1 -2 0 -1 -1 1 -1 0 -1 2 1 1 1 2 -1 -2 -1 -1 -1 2 1 1 -2 -1 0 -1 -2 1 -1 -1 1 -2 0 2 2 2 0 -1...
output:
58689 37381 26514 5286 55438 22510 58677 87566 101370 8711 67551 30807 80758 105377 88704 102000 106139 90360 65982
result:
ok 19 numbers
Test #19:
score: 0
Accepted
time: 116ms
memory: 4348kb
input:
21 96503 245576140 93498061 701056315 -605158281 -539594223 -400851367 776858158 -122004876 288965172 -446543604 580736800 -29423229 -623461088 -180847912 -380850659 420913114 600726663 -576168022 -982238607 649467917 196657414 847050122 197317480 766825179 212556787 -43663152 958641254 941239520 65...
output:
48252942286075 34860910058758 47067724355617 32633610706940 10635651528054 4985472050541 22277795901056 38936262576660 40198337049966 20813952671802 14303319357861 9032183538470 14486727681041 22591125920502 30250643106360 2711405951838 16931642017586 9535152173316 27428616549219 9006162068487 43182...
result:
ok 21 numbers
Test #20:
score: 0
Accepted
time: 56ms
memory: 10832kb
input:
1 1000000 -2 2 2 2 1 0 2 0 0 1 -2 -1 2 -2 -1 -2 -1 1 1 2 0 2 0 -1 -1 -2 2 -2 2 -2 2 2 -2 2 1 -2 2 0 -2 -1 0 -2 0 1 -1 2 1 2 -2 0 -1 2 2 2 -1 -1 -2 -1 -1 2 0 1 -2 1 -2 2 -2 -2 -2 1 -2 1 -2 0 -2 -1 -1 0 2 -1 2 1 2 2 1 2 -2 -1 2 -1 1 -2 -1 0 2 1 -2 0 -2 1 1 2 -2 0 -1 1 -2 0 -1 2 1 1 0 2 -2 1 -2 -2 2 2 ...
output:
1198620
result:
ok 1 number(s): "1198620"
Test #21:
score: 0
Accepted
time: 134ms
memory: 11180kb
input:
1 1000000 -349046927 402841000 -720575139 -857252792 -629068879 -481732546 -61145572 -632007599 -358430818 -964160033 959559256 -842708498 549512880 396138719 199024120 -727109977 91870193 833567119 688308694 855833457 154761308 569412074 -513418907 -883935167 -46524956 -417485991 37150770 -44011495...
output:
499950632364902
result:
ok 1 number(s): "499950632364902"