Submission #442951

# Submission time Handle Problem Language Result Execution time Memory
442951 2021-07-09T11:46:37 Z benedict0724 Distributing Candies (IOI21_candies) C++17
0 / 100
98 ms 16204 KB
#include "candies.h"

#include <vector>
using namespace std;
typedef long long ll;

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    int n = c.size();
    int q = l.size();
    std::vector<ll> s(n);
    for(int i=0;i<q;i++)
    {
        s[l[i]] += v[i];
        if(r[i] < n-1) 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++) s[i] = min(s[i], (ll)c[i]);
    vector<int> ans;
    for(int i=0;i<n;i++) ans[i] = s[i];
    return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 98 ms 16204 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -