Submission #440867

# Submission time Handle Problem Language Result Execution time Memory
440867 2021-07-03T11:55:54 Z ogibogi2004 Distributing Candies (IOI21_candies) C++17
8 / 100
124 ms 8880 KB
#include "candies.h"

#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    ll n = c.size(),q=l.size();
    vector<int> s(n,0);
    vector<ll> pref(n+1,0);
    for(ll i=0;i<q;i++)
    {
		pref[l[i]]+=v[i];
		pref[r[i]+1]-=v[i];
	}
	for(ll i=0;i<n;i++)
	{
		if(i!=0)pref[i]=pref[i-1]+pref[i];
		s[i]=min(pref[i],(ll)c[i]);
	}
    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 124 ms 8808 KB Output is correct
2 Correct 116 ms 8880 KB Output is correct
3 Correct 115 ms 8804 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 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -