Submission #829544

# Submission time Handle Problem Language Result Execution time Memory
829544 2023-08-18T12:31:57 Z Abrar_Al_Samit Distributing Candies (IOI21_candies) C++17
0 / 100
73 ms 16284 KB
#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();
    int q = l.size();

    vector<long long>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], (long long)c[i]);
    }
    vector<int>cs;
    for(int i=0; i<n; ++i) cs[i] = s[i];
    return cs;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 73 ms 16284 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -