QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#248286 | #7622. Yet Another Coffee | ucup-team266# | AC ✓ | 227ms | 8212kb | C++20 | 1.3kb | 2023-11-11 18:10:29 | 2023-11-11 18:10:29 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
ll a[200200];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>a[i];
vector<pii> vec;
while(m--)
{
int x,y;
cin>>x>>y;
vec.pb(x,y);
}
srt(vec);
int p=1,p2=1;
for(auto pr:vec)
{
int r=pr.first;
ll w=pr.second;
while(p<r)
{
p++;
if(a[p]<a[p2])
p2=p;
}
a[p2]-=w;
}
sort(a+1,a+n+1);
ll sum=0;
for(int i=1;i<=n;i++)
{
sum+=a[i];
cout<<sum<<' ';
}
cout<<'\n';
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
5 10 14 17 37 59 65 53 73 68 177 160 111 10 177 5 193 2 30 3 63 2 339 3 263 5 178 2 190 9 23 10 328 10 200 9 8 3 391 6 230 12 9 152 306 86 88 324 59 18 14 42 260 304 55 3 50 2 170 1 252 7 811 1 713 7 215 10 201 4 926 8 319 19 20 182 74 180 201 326 243 195 31 170 263 284 233 48 166 272 281 179 116 31...
output:
-2596 -2559 -2506 -2447 -2382 -2314 -2241 -2130 -1970 -1793 -3505 -3491 -3473 -3431 -3376 -3317 -3231 -3143 -2883 -2579 -2273 -1949 -6527 -6496 -6448 -6374 -6258 -6092 -5922 -5743 -5563 -5368 -5167 -4934 -4691 -4428 -4156 -3875 -3591 -3272 -2946 -3219 -2987 -2572 -2140 -1707 -1238 -768 -274 243 1...
result:
ok 70 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2 5 2 1 2 3 4 5 3 1 4 2 7 3 4 3 1 10 3 8 6 4 9 3 8 4 5
output:
-2 0 3 7 12 -21 -18 -15 -11 -5 3 13
result:
ok 12 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
8 1 0 72916 9 11 130289 240521 653024 625847 679075 529899 486802 540872 353600 2 5400 2 257841 6 48161 3 71484 9 156788 3 181910 4 45589 6 210869 5 70426 9 87059 5 115764 8 7 634608 412120 360938 425426 825551 138578 678304 747502 2 235317 4 281859 5 553042 8 295615 8 32014 8 755313 4 439284 19 10 ...
output:
72916 -1121002 -880481 -526881 -40079 489820 1030692 1656539 2309563 2988638 -2180324 -2041746 -1680808 -1255382 -620774 57530 805032 1630583 -1025384 -1022941 -1018403 -1013731 -1006580 -998875 -987675 -970496 -953098 -932654 -909692 -886331 -862054 -835158 -807901 -779123 -747157 -713222 -67928...
result:
ok 85 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
5 18 24 561699155 345484852 420718917 108291879 553918474 392861085 299874093 28528146 248352314 398850144 248444258 89834833 251398697 101739017 240342391 320200928 481962939 343719433 5 354704 6 9355942 7 7098134 16 38746862 15 35848885 14 42058214 15 18411581 9 23207206 18 19518309 14 20707458 13...
output:
-416165974 -387637828 -297802995 -196063978 44278413 292630727 541074985 792473682 1079767658 1379641751 1699842679 2043562112 2436423197 2835273341 3255992258 3737955197 4291873671 4853572826 335919368 705602908 146524143 438492672 -3870833640 -3817930784 -3749728771 -3627446160 -3471700060 -322...
result:
ok 39 numbers
Test #5:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
9 30 20 150 250 278 8 74 295 357 116 543 287 37 345 14 173 153 407 136 269 121 109 318 401 280 500 267 257 238 312 225 477 10 293 13 162 29 145 13 120 2 17 3 192 21 70 7 102 1 286 18 50 1 296 3 308 21 24 13 118 8 22 9 52 21 156 11 258 9 263 23 234 13 20 145 133 51 146 103 103 44 154 173 68 171 13 6 ...
output:
-3018 -3010 -2996 -2959 -2885 -2776 -2660 -2539 -2403 -2250 -2077 -1852 -1614 -1364 -1107 -840 -571 -293 -13 274 569 881 1199 1544 1901 2302 2709 3186 3686 4229 -3232 -3226 -3213 -3169 -3118 -3050 -2947 -2844 -2699 -2553 -2399 -2228 -2055 -23341 -23339 -23319 -23279 -23197 -23103 -22992 -22875 -22...
result:
ok 694 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 3824kb
input:
9 87 116 40104 112075 7416 91610 15866 12407 44611 15506 71100 14593 94026 42334 100025 20930 80680 11015 98242 109216 13019 67252 116919 68275 107504 52576 17004 40039 3037 3881 44570 1353 94585 79675 7339 45331 22404 97901 9724 80802 83388 2473 85549 94423 10967 43969 113695 20677 109374 20004 580...
output:
-38209921 -38209327 -38207974 -38205501 -38202766 -38199729 -38195848 -38188509 -38181002 -38171278 -38160931 -38149964 -38138949 -38126542 -38113990 -38100971 -38086378 -38071673 -38056167 -38040301 -38023297 -38005459 -37987197 -37967845 -37947841 -37927709 -37907032 -37886102 -37863698 -37839904 ...
result:
ok 983 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
9 86 142 92213517 9496672 49452489 24822910 83754542 16205794 51389688 428375 1002851 48157164 52117680 59497763 17633347 58906367 68451067 79249434 54433105 31464502 7839830 61662667 51765587 76375691 4573781 56984987 44487325 2241633 52805129 47978257 15910569 100187672 23178562 42273363 79351960 ...
output:
-10124197529 -10124108337 -10123679962 -10122830890 -10121828039 -10120652318 -10118781420 -10116539787 -10113419124 -10108845343 -10102599494 -10095899018 -10088059188 -10076939018 -10063282872 -10049105892 -10033195323 -10016989529 -9999756298 -9982122951 -9963976050 -9945199830 -9923352279 -99010...
result:
ok 692 numbers
Test #8:
score: 0
Accepted
time: 3ms
memory: 3684kb
input:
6 1067 1710 10 126 165 174 30 63 80 3 27 92 236 228 111 23 149 204 136 88 112 209 215 97 174 33 191 119 132 119 75 148 217 100 44 228 219 242 192 135 199 192 116 60 101 183 201 7 110 98 29 160 46 17 202 62 140 33 155 7 95 4 64 31 203 171 126 160 153 245 230 53 172 200 63 46 238 145 224 72 40 89 13 9...
output:
-165754 -165753 -165752 -165751 -165750 -165749 -165748 -165746 -165744 -165742 -165740 -165737 -165734 -165731 -165727 -165723 -165719 -165715 -165711 -165707 -165702 -165697 -165692 -165687 -165682 -165677 -165672 -165666 -165660 -165654 -165648 -165642 -165636 -165630 -165624 -165618 -165611 -165...
result:
ok 7123 numbers
Test #9:
score: 0
Accepted
time: 4ms
memory: 3628kb
input:
10 91 60 121067 735043 657233 241687 762162 115139 571678 88967 287738 448211 122872 352608 564952 661168 284979 451332 533 423562 498017 727569 159355 138992 555614 14313 782085 93040 452229 478253 432717 529858 607759 84262 444015 85191 649296 465891 474353 301611 156490 683860 173773 337140 29060...
output:
-24499779 -24499246 -24492385 -24478072 -24437183 -24395244 -24339629 -24282938 -24216256 -24146644 -24062382 -23977191 -23891367 -23804635 -23715668 -23622628 -23507489 -23384617 -23255319 -23116327 -22959837 -22800482 -22628671 -22454898 -22269412 -22072264 -21830577 -21579729 -21323958 -21057640 ...
result:
ok 10787 numbers
Test #10:
score: 0
Accepted
time: 4ms
memory: 3556kb
input:
9 1216 716 157204975 195516644 282736891 144203909 389181163 124406996 48370860 15779707 258191873 424060854 216137375 362762758 255186885 62027462 127691552 307876772 32370909 165899011 265000287 213375339 305320675 12924365 193231703 244714450 149078313 174025044 73221562 224992083 206784534 11730...
output:
-24483429239 -24482693638 -24481572401 -24480434657 -24479296574 -24477908592 -24476425384 -24474880801 -24472417201 -24469943927 -24467377821 -24464568924 -24461519318 -24458455089 -24455196742 -24450363915 -24444363241 -24437812570 -24430644713 -24421737487 -24412522121 -24403223791 -24393082366 -...
result:
ok 10594 numbers
Test #11:
score: 0
Accepted
time: 36ms
memory: 4200kb
input:
8 11577 16477 228 100 299 369 11 376 87 141 179 287 609 128 172 354 85 423 115 246 312 439 258 203 583 127 8 435 631 557 202 247 228 308 376 490 640 15 213 76 163 634 50 2 408 467 571 157 213 261 164 118 523 532 528 586 396 307 259 372 39 372 322 301 445 206 60 77 351 347 150 193 257 626 111 418 546...
output:
-6288301 -6288300 -6288299 -6288298 -6288297 -6288296 -6288295 -6288294 -6288293 -6288292 -6288291 -6288290 -6288289 -6288288 -6288287 -6288286 -6288284 -6288282 -6288280 -6288278 -6288276 -6288274 -6288272 -6288270 -6288268 -6288266 -6288264 -6288262 -6288260 -6288258 -6288256 -6288253 -6288250 -62...
result:
ok 118048 numbers
Test #12:
score: 0
Accepted
time: 22ms
memory: 4184kb
input:
8 2170 1934 535263 726298 642479 218399 641782 854221 851733 174217 100075 706854 744111 40844 407229 735348 96977 431442 24001 835272 428435 286111 844410 397533 439877 445702 658631 150596 237445 323197 171130 177732 354629 618465 545837 260182 584719 108433 471186 423718 479470 890590 163725 6675...
output:
-172567265 -172566570 -172565524 -172564295 -172562209 -172559987 -172557543 -172554892 -172551242 -172547479 -172543694 -172539420 -172535093 -172530353 -172525450 -172520296 -172512330 -172504172 -172495755 -172487183 -172478602 -172469786 -172460922 -172452038 -172442964 -172433675 -172424140 -17...
result:
ok 89656 numbers
Test #13:
score: 0
Accepted
time: 32ms
memory: 4104kb
input:
9 17593 25702 383135191 2982885 579395998 27346375 549689611 171615873 459123924 590161106 513175283 299272610 386910229 335756449 493040798 472420555 114781943 260078547 592860852 609665441 142572193 570055541 168039635 211184400 495353178 420485670 419216517 193790110 460242138 308510752 271442416...
output:
-8758707761149 -8758707731246 -8758707672737 -8758707611486 -8758707514595 -8758707415987 -8758707300983 -8758707154905 -8758706987132 -8758706810997 -8758706454330 -8758706093315 -8758705701392 -8758705297835 -8758704870341 -8758704437699 -8758703987633 -8758703484731 -8758702944760 -8758702365444 ...
result:
ok 86646 numbers
Test #14:
score: 0
Accepted
time: 152ms
memory: 8212kb
input:
7 6800 5978 60 69 23 86 75 48 43 100 26 15 24 66 74 3 53 16 100 35 63 17 31 85 61 80 74 74 11 26 14 88 44 68 10 1 90 77 42 36 14 59 32 18 8 81 10 16 73 75 7 100 30 68 49 51 64 6 51 102 81 79 42 9 26 18 11 44 22 62 7 83 74 80 101 26 25 90 3 65 77 89 60 35 4 101 29 14 54 96 1 74 41 54 46 61 46 52 28 5...
output:
-1997112 -1997111 -1997110 -1997109 -1997108 -1997107 -1997106 -1997105 -1997104 -1997103 -1997102 -1997101 -1997100 -1997099 -1997098 -1997097 -1997096 -1997095 -1997094 -1997093 -1997092 -1997091 -1997090 -1997089 -1997088 -1997087 -1997086 -1997085 -1997084 -1997083 -1997082 -1997081 -1997080 -19...
result:
ok 559540 numbers
Test #15:
score: 0
Accepted
time: 227ms
memory: 7452kb
input:
8 129290 81841 135817 410713 330691 320112 132181 174498 299216 378961 85314 167742 340352 360495 59228 507118 222893 229624 97537 115998 504070 55221 192317 196386 74392 244698 358490 82189 61703 327262 431237 18466 336492 166829 470561 5179 2577 510428 374447 415257 534494 444489 121441 190385 945...
output:
-30963809525 -30963809523 -30963809518 -30963809510 -30963809489 -30963809464 -30963809438 -30963809410 -30963809378 -30963809339 -30963809299 -30963809257 -30963809201 -30963809143 -30963809081 -30963809017 -30963808942 -30963808867 -30963808790 -30963808712 -30963808623 -30963808519 -30963808410 -...
result:
ok 757965 numbers
Test #16:
score: 0
Accepted
time: 212ms
memory: 6924kb
input:
5 102270 191135 23814121 34675880 61758390 5405347 18165369 16331015 10250401 40160489 68511164 60267595 72023262 6734399 38171575 7553285 70883323 65005120 7134746 13099681 40994831 33163526 2756413 63258166 75433884 25920337 37546193 52296257 25493193 40946292 67087140 11106826 13228573 22315126 7...
output:
-95387660102890 -95387660102428 -95387660101870 -95387660101034 -95387660100130 -95387660099043 -95387660096688 -95387660093920 -95387660091141 -95387660085397 -95387660079160 -95387660072648 -95387660065488 -95387660057925 -95387660050314 -95387660041695 -95387660032845 -95387660023755 -95387660014...
result:
ok 638285 numbers
Extra Test:
score: 0
Extra Test Passed