#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define F first
#define S second
#define pb push_back
#define sz(x) (ll)x.size()
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
void printVct(vi &v){
for (ll i =0; i<sz(v); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
vi distribute_candies(vi c, vi l, vi r, vi v) {
ll n = sz(c);
ll q = sz(l);
vi s(n);
for (ll i =0; i<q; i++){
for (ll j = l[i]; j<=r[i]; j++){
s[j] = max(min(c[j], s[j] + v[i]), 0);
}
}
return s;
}
/*
3
10 15 13
2
0 2 20
0 1 -11
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5055 ms |
12116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
139 ms |
8020 KB |
Output is correct |
3 |
Correct |
154 ms |
6028 KB |
Output is correct |
4 |
Execution timed out |
5029 ms |
13240 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
338 ms |
7792 KB |
Output is correct |
4 |
Correct |
363 ms |
4028 KB |
Output is correct |
5 |
Execution timed out |
5064 ms |
10988 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Execution timed out |
5055 ms |
12116 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |