답안 #1028640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1028640 2024-07-20T06:35:59 Z JahonaliX 사탕 분배 (IOI21_candies) C++17
3 / 100
79 ms 7360 KB
#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(), q = v.size();
    vector<int> a(n);
    if (n <= 2000 && q <= 2000) {
        for (int i = 0; i < q; ++i) for (int j = l[i]; j <= r[i]; ++j) a[j] = max(0, min(c[j], a[j] + v[i]));
    }
    else {
        bool ok = true;
        for (int i : v) ok &= i > 0;
        if (ok) {
            for (int i = 0; i < q; ++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];
            for (int i = 0; i < n; ++i) a[i] = min(a[i], c[i]);
        }
        else {

        }
    }
    return a;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 79 ms 7360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 34 ms 5116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 30 ms 4952 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Incorrect 79 ms 7360 KB Output isn't correct
7 Halted 0 ms 0 KB -