Submission #623039

# Submission time Handle Problem Language Result Execution time Memory
623039 2022-08-05T06:16:12 Z Hanksburger Distributing Candies (IOI21_candies) C++17
8 / 100
100 ms 14012 KB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
vector<long long> ans;
vector<int> ret;
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v)
{
    int n=c.size(), q=v.size();
    for (int i=0; i<n; i++)
    {
        ans.push_back(0);
        ret.push_back(0);
    }
    for (int i=0; i<q; i++)
    {
        ans[l[i]]+=v[i];
        if (r[i]<=n-2)
            ans[r[i]+1]-=v[i];
    }
    for (int i=1; i<n; i++)
        ans[i]+=ans[i-1];
    for (int i=0; i<n; i++)
        ret[i]=ans[i]=min(c[i]+0LL, ans[i]);
    return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 100 ms 9828 KB Output is correct
2 Correct 98 ms 14012 KB Output is correct
3 Correct 93 ms 13756 KB Output is correct
# 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -