QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#611323#7622. Yet Another CoffeePepinotWA 3ms3872kbC++20788b2024-10-04 20:23:562024-10-04 20:23:57

Judging History

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

  • [2024-10-04 20:23:57]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3872kb
  • [2024-10-04 20:23:56]
  • 提交

answer

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

void solve() {
    int n,m; cin>>n>>m;
    vector<ll> v(n+1);
    for(int i=1; i<=n; i++) cin>>v[i];

    vector<int> sub(n+1);
    fill(sub.begin(),sub.end(),0);

    for(int i=0; i<m; i++) {
        int a,b; cin>>a>>b;
        sub[a]+=b;
    }

    for(int i=1,minn=1; i<=n; i++) {
        if(v[minn]>v[i]) minn=i;
        v[minn]-=sub[i];
    }
    sort(v.begin()+1,v.end());
    v[0]=0;
    for(int i=1; i<=n; i++) {
        v[i]+=v[i-1];
        cout<<v[i]<<" ";
    }
    cout<<endl;

}
int main() {
    ios::sync_with_stdio(false),cin.tie(nullptr);
    int t; cin>>t;
    while(t--)
        solve();

}

/*
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
 */

详细

Test #1:

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

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: 3536kb

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: 3784kb

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: 3576kb

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: 3596kb

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: 3540kb

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: 3796kb

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: 2ms
memory: 3624kb

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: 3ms
memory: 3872kb

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: -100
Wrong Answer
time: 0ms
memory: 3620kb

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:

wrong answer 3114th numbers differ - expected: '-889175873093', found: '-863406069317'