Submission #546813

# Submission time Handle Problem Language Result Execution time Memory
546813 2022-04-08T14:26:03 Z Trisanu_Das Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int[] distribute_candies(int[] c, int[] l, int[] r, int[] v){
  int n = c.size();
  vector<int> a(n);
  for(int i = 0; i < q; ++i) {
        for(int j = l[i]; j <= l[i]; ++j) {
            a[j] += v[i];
            a[j] = max(a[j], 0); a[j] = min(a[j], c[j]);
        }
    }
    return a;
}

Compilation message

candies.cpp:4:4: error: structured binding declaration cannot have type 'int'
    4 | int[] distribute_candies(int[] c, int[] l, int[] r, int[] v){
      |    ^~
candies.cpp:4:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
candies.cpp:4:4: error: empty structured binding declaration
candies.cpp:4:7: error: expected initializer before 'distribute_candies'
    4 | int[] distribute_candies(int[] c, int[] l, int[] r, int[] v){
      |       ^~~~~~~~~~~~~~~~~~