#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using vi = vector<int>;
using ll = long long;
vi distribute_candies(vi c, vi l, vi r, vi v){
int n = sz(c), q = sz(l); vector<int> ans(n,0);
for(int i = 0; i < q; i++){
for(int j = l[i]; j <= r[i]; j++){
ans[j]+=v[i]; ans[j]=min(ans[j],c[j]);
ans[j]=max(ans[j],0);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
480 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1974 ms |
12340 KB |
Output is correct |
2 |
Correct |
1857 ms |
11576 KB |
Output is correct |
3 |
Correct |
1829 ms |
11412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
49 ms |
8164 KB |
Output is correct |
3 |
Correct |
51 ms |
5952 KB |
Output is correct |
4 |
Correct |
1936 ms |
13392 KB |
Output is correct |
5 |
Correct |
1899 ms |
13812 KB |
Output is correct |
6 |
Correct |
1963 ms |
14200 KB |
Output is correct |
7 |
Correct |
1925 ms |
13544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
73 ms |
7784 KB |
Output is correct |
4 |
Correct |
77 ms |
4028 KB |
Output is correct |
5 |
Execution timed out |
5050 ms |
10836 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
480 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1974 ms |
12340 KB |
Output is correct |
7 |
Correct |
1857 ms |
11576 KB |
Output is correct |
8 |
Correct |
1829 ms |
11412 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
49 ms |
8164 KB |
Output is correct |
11 |
Correct |
51 ms |
5952 KB |
Output is correct |
12 |
Correct |
1936 ms |
13392 KB |
Output is correct |
13 |
Correct |
1899 ms |
13812 KB |
Output is correct |
14 |
Correct |
1963 ms |
14200 KB |
Output is correct |
15 |
Correct |
1925 ms |
13544 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
73 ms |
7784 KB |
Output is correct |
19 |
Correct |
77 ms |
4028 KB |
Output is correct |
20 |
Execution timed out |
5050 ms |
10836 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |