QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#524458#1140. Distributing CandiesMousa_Aboubaker#0 57ms11824kbC++20829b2024-08-19 18:05:582024-08-19 18:05:59

Judging History

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

  • [2024-08-19 18:05:59]
  • 评测
  • 测评结果:0
  • 用时:57ms
  • 内存:11824kb
  • [2024-08-19 18:05:58]
  • 提交

answer

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

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v)
{
    int n = c.size();
    vector<long long> a(n + 1);
    for(int i = 0; i < l.size(); i++)
    {
        if(v[i] > 0)
        {
            v[i] = min(c.front(), v[i]);
        }
        else
        {
            v[i] = max(-c.front(), v[i]);
        }
        a[l[i]] += v[i];
        if(r[i] + 1 < n)
        {
            a[r[i] + 1] -= v[i];
        }
    }

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

    vector<int> res(n);
    for(int i = 0; i < n; i++)
    {
        res[i] = min(c[i] * 1ll, a[i]);
        if(a[i] < 0)
        {
            res[i] = 0;
        }
    }

    return res;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 3
Accepted
time: 0ms
memory: 3768kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
8
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
8
0 7 1
0 7 1
0 7 300000000
0 7 994967293
0 7 1
0 7 1000000000
0 7 1000000000
0 7 1000000000

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

result:

ok 3 lines

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3768kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
283 43634 101056 10340 6009 5133 30 2 3677888 210
10
1 8 26416
2 7 -51219
2 4 17793
3 7 75426
3 7 22307
1 1 60258
3 7 -29824
0 8 24839
2 8 -60304
0 1 -26411

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 566 283 566 566 283 30 2 283 0

result:

wrong answer 3rd lines differ - expected: '0 17223 0 0 0 0 0 0 0 0', found: '0 566 283 566 566 283 30 2 283 0'

Subtask #2:

score: 0
Wrong Answer

Test #6:

score: 8
Accepted
time: 56ms
memory: 11824kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
11408901 370732653 37843 28 53693 15782410 103 297546 1112427 170319071 26 1 6172 11614171 431 884673599 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 31012465 55362 253 2363145 47186217 1103 19622 594 7867 1 4299 28130 48 4689582 12 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
87153 87153 37843 28 53693 406667 103 297546 766665 971468 26 1 6172 1257294 431 1536484 1 3 50085 154 57 28200 145886 898969 74758 72 845768 6 69787 11 3043755 55362 253 2363145 3459533 1103 19622 594 7867 1 4299 28130 48 4317336 12 431 123 4531465 4806 3...

result:

ok 3 lines

Test #7:

score: 0
Wrong Answer
time: 57ms
memory: 11792kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
200000
36 596 2 302 1 22 7381829 295 411 221 267845 2822 635 22 45033 2 3 24 15 1 585 2832326 80 499271 110 192 6185 1752 302907 52967 3 3423576 5373 63 2196 35 113 1209 303 12 89 4572 4 13274 5867 10158 33467 3128 776575 59189 23 11698 637 3 330 1 1 18 3534 ...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
36 144 2 230 1 22 301 295 314 221 422 494 530 22 548 2 3 24 15 1 585 1044 80 1116 110 192 1236 1236 1272 1346 3 1418 1433 63 1562 35 113 1209 303 12 89 2169 4 2171 2171 2271 2441 2477 2541 2613 23 2933 637 3 330 1 1 18 3380 2589 3612 3684 1042 3838 1 3874 ...

result:

wrong answer 3rd lines differ - expected: '36 295 2 302 1 22 529 295 411 ...730 655 1 396 23 468 52 125 113', found: '36 144 2 230 1 22 301 295 314 ... 435 399 1 312 23 312 52 111 99'

Subtask #3:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 1ms
memory: 3784kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

wrong answer 3rd lines differ - expected: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0', found: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'

Subtask #4:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 4020kb

input:

lrts0z0ktpqc670i0etyqgyb45dt1dysq5ap2mzg
10
11 440 51 41 11 1 3 108 148 14
10
0 9 60
0 9 -9
0 9 -30
0 9 41
0 9 82
0 9 69
0 9 -79
0 9 -39
0 9 72
0 9 41

output:

4lpv73iykswp9e3nppi3jw2qggm5dfz29yy9nzpq
OK
11 24 24 24 11 1 3 24 24 14

result:

wrong answer 3rd lines differ - expected: '11 208 51 41 11 1 3 108 143 14', found: '11 24 24 24 11 1 3 24 24 14'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%