답안 #814133

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
814133 2023-08-08T05:45:52 Z LittleCube 사탕 분배 (IOI21_candies) C++17
11 / 100
97 ms 8256 KB
#include "candies.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;

vector<int> distribute_candies(vector<int> c, vector<int> l,
                               vector<int> r, vector<int> v)
{
    int n = c.size(), q = l.size();
    if (q <= 2000)
    {
        vector<int> s(n, 0);
        for (int i = 0; i < q; i++)
        {
            for (int j = l[i]; j <= r[i]; j++)
                s[j] = max(0, min(c[j], s[j] + v[i]));
        }
        return s;
    }
    else
    {
        vector<ll> s(n + 1);
        for (int i = 0; i < q; i++)
            s[l[i]] += v[i], s[r[i] + 1] -= v[i];
        for (int i = 1; i <= n; i++)
            s[i] += s[i - 1];
        for (int i = 0; i < n; i++)
            c[i] = min((ll)c[i], s[i]);
        return c;
    }
    return {};
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 3 ms 412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 8256 KB Output is correct
2 Correct 89 ms 8180 KB Output is correct
3 Correct 77 ms 8180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Incorrect 51 ms 5080 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 50 ms 5048 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 3 ms 412 KB Output is correct
6 Correct 97 ms 8256 KB Output is correct
7 Correct 89 ms 8180 KB Output is correct
8 Correct 77 ms 8180 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Incorrect 51 ms 5080 KB Output isn't correct
11 Halted 0 ms 0 KB -