QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#524368 | #1140. Distributing Candies | Fadel_elsenusi# | Compile Error | / | / | C++17 | 522b | 2024-08-19 16:30:59 | 2024-08-19 16:31:00 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <array>
using namespace std;
array<int,200000>distribute_candies(int c[], int l[], int r[], int v[]){
int sz=0,vsz=0;
int arr[sz+1];
for(int i=0;i<=n;++i){
arr[i]=0;
}
for(int i=0;i<vsz;++i){
arr[l[i]]+=v[i];
arr[r[i]+1]-=v[i];
}
for(int i=1;i<n;++i){
arr[i]+=arr[i-1];
}
for(int i=0;i<n;++i){
arr[i]=min(arr[i],c[i]);
arr[i]=max(0,arr[i]);
}
return arr[];
}
Details
answer.code: In function ‘std::array<int, 200000> distribute_candies(int*, int*, int*, int*)’: answer.code:8:20: error: ‘n’ was not declared in this scope 8 | for(int i=0;i<=n;++i){ | ^ answer.code:15:19: error: ‘n’ was not declared in this scope 15 | for(int i=1;i<n;++i){ | ^ answer.code:18:19: error: ‘n’ was not declared in this scope 18 | for(int i=0;i<n;++i){ | ^ answer.code:22:16: error: expected primary-expression before ‘]’ token 22 | return arr[]; | ^