QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#524368#1140. Distributing CandiesFadel_elsenusi#Compile Error//C++17522b2024-08-19 16:30:592024-08-19 16:31:00

Judging History

你现在查看的是最新测评结果

  • [2024-08-19 16:31:00]
  • 评测
  • [2024-08-19 16:30:59]
  • 提交

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[];
      |                ^