Submission #829542

# Submission time Handle Problem Language Result Execution time Memory
829542 2023-08-18T12:30:45 Z Abrar_Al_Samit Distributing Candies (IOI21_candies) C++17
0 / 100
87 ms 7232 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<int>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], c[i]);
    }
    return s;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 7232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -