Submission #436436

# Submission time Handle Problem Language Result Execution time Memory
436436 2021-06-24T13:40:46 Z PiejanVDC Distributing Candies (IOI21_candies) C++17
8 / 100
130 ms 8900 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(), q = v.size();
    vector<int64_t>dif(n+1,0);
    for(int i = 0 ; i < q ; i++) {
        dif[l[i]]+=v[i],dif[r[i]+1]-=v[i];
    }
    vector<int>ans(n);
    int64_t curr=0;
    for(int i = 0 ; i < n ; i++) {
        curr+=dif[i];
        ans[i]=min((int64_t)c[i],curr);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 130 ms 8880 KB Output is correct
2 Correct 120 ms 8800 KB Output is correct
3 Correct 129 ms 8900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -