QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#190664#3141. Foehn PhenomenaCamillus#0 57ms4748kbC++201.0kb2023-09-29 12:10:482024-07-04 02:11:25

Judging History

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

  • [2024-07-04 02:11:25]
  • 评测
  • 测评结果:0
  • 用时:57ms
  • 内存:4748kb
  • [2023-09-29 12:10:48]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, q, s, t;
    cin >> n >> q >> s >> t;
    vector<int> a(n + 1);
    for (int i = 0; i <= n; i++) {
        cin >> a[i];
    }
    
    vector<int> b(n);

    int sum0 = 0;
    int sum1 = 0;

    auto change = [&](int i, int x) {
        if (b[i] < 0) {
            sum0 -= b[i];
        } else {
            sum1 -= b[i];
        }
        b[i] += x;
        if (b[i] < 0) {
            sum0 += b[i];
        } else {
            sum1 += b[i];
        }
    };

    for (int i = 0; i < n; i++) {
        change(i, a[i + 1] - a[i]);
    }

    for (int j = 0; j < q; j++) {
        int l, r, x;
        cin >> l >> r >> x;

        change(l - 1, x);

        if (r != n) {
            change(r, -x);
        }

        cout << -sum0 * t - sum1 * s << '\n';
    }
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 30
Accepted
time: 1ms
memory: 3828kb

input:

1999 1999 1 1
0
361955
578909
-854798
-859726
514839
-30508
-111746
-597624
-847947
-823507
402362
860826
580634
-130241
-861004
-491067
-972576
263274
82135
-787505
-436755
-610884
113239
-852249
800710
151322
-699362
-415053
844863
-929401
573522
123399
467286
-768486
265085
373884
-310011
-428889...

output:

653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117
653117...

result:

ok 1999 lines

Test #2:

score: -30
Wrong Answer
time: 0ms
memory: 3800kb

input:

1998 2000 109 330
0
955722
978070
-904438
142717
-981711
-160448
-192233
-981992
-554688
-426353
367412
-324002
-254777
-485943
-104144
-909219
350106
112473
36699
939972
283616
-10951
710934
335883
992349
698607
-623972
-834077
-664857
610984
674410
877503
-531816
-363914
-373775
811400
-436217
945...

output:

-651339235
-651339235
-636856221
-697440940
-548685398
-393790034
-271676484
-271676484
-71865301
21882236
97514182
97514182
121397431
123706218
205418758
205418758
214958223
254077433
282338913
262594331
371293181
371293181
371293181
416421602
553437182
692218110
625807831
640003324
590854250
59085...

result:

wrong answer 1st lines differ - expected: '149672516125', found: '-651339235'

Subtask #2:

score: 0
Wrong Answer

Test #22:

score: 10
Accepted
time: 55ms
memory: 4680kb

input:

199999 199999 1 1
0
959891
-343065
13581
237746
860327
-320318
907303
-148121
-692995
154478
-346488
-713761
901786
-882286
179062
-734254
345880
-375432
646742
-663178
793986
-769588
-464537
188558
-725826
215198
-567993
-518760
844631
-396749
3182
-616994
584696
20180
-512289
-928005
-741421
-8710...

output:

284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267
284267...

result:

ok 199999 lines

Test #23:

score: 0
Accepted
time: 56ms
memory: 4748kb

input:

199998 200000 109 109
0
-69725
211444
347083
-523022
-970942
509266
295190
77072
-3930
-544073
930225
912181
324210
696136
-160034
-298376
649585
-275966
850624
788098
-915712
-988587
274683
551282
-328471
-215242
-943378
-204717
-131644
562122
-793698
-132091
862078
182602
-256876
329126
756562
979...

output:

-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
-72171298
...

result:

ok 200000 lines

Test #24:

score: -10
Wrong Answer
time: 56ms
memory: 4620kb

input:

200000 199999 1000000 1000000
0
132400
589991
345399
697956
-973355
206404
-774838
-920617
-703056
-378438
-203720
-533083
493927
444942
-762739
-606050
-371552
-819661
991171
-996529
72490
367019
-60653
-522555
645250
347645
-505267
-323464
560167
944385
799989
200658
605109
420594
-278261
603293
3...

output:

559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
559781184
...

result:

wrong answer 1st lines differ - expected: '-553491000000', found: '559781184'

Subtask #3:

score: 0
Wrong Answer

Test #35:

score: 60
Accepted
time: 57ms
memory: 4728kb

input:

199999 199999 1 1
0
173234
-927920
674265
244933
-404760
82932
219154
-330462
-602045
-297954
-936143
465791
627953
-853988
890893
665370
350915
468704
-604989
83237
889756
386366
-693949
-944375
672570
914665
384141
-419168
464457
-166099
-49743
48836
-630409
-328740
971362
928078
504477
-807494
-5...

output:

224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826
224826...

result:

ok 199999 lines

Test #36:

score: -60
Wrong Answer
time: 54ms
memory: 4624kb

input:

199998 200000 109 330
0
-91233
39049
188825
886169
196896
308216
940918
-472860
-470105
-207557
-577193
228251
885437
-319743
558836
645357
-22788
895952
115291
251143
238169
897811
955110
942429
-972057
-908314
713389
-197401
546348
-248084
-309874
-558178
-98646
300968
998590
467219
371222
896386
...

output:

-438883775
-364666671
-299242936
-218125991
-91465587
-98373826
-8803410
-66706294
17426638
22999816
22999816
170610799
278221887
427472248
552166194
617290032
726438838
780889923
780889923
780889923
738525991
834024511
866043875
815330121
867527448
1021443561
992838205
997804738
1000247672
10002476...

result:

wrong answer 1st lines differ - expected: '14714119072321', found: '-438883775'