Submission #546815

# Submission time Handle Problem Language Result Execution time Memory
546815 2022-04-08T14:27:25 Z Trisanu_Das Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
vector<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:38: error: expected ',' or '...' before 'c'
    4 | vector<int> distribute_candies(int[] c, int[] l, int[] r, int[] v){
      |                                      ^
candies.cpp: In function 'std::vector<int> distribute_candies(int*)':
candies.cpp:5:11: error: 'c' was not declared in this scope
    5 |   int n = c.size();
      |           ^
candies.cpp:7:22: error: 'q' was not declared in this scope
    7 |   for(int i = 0; i < q; ++i) {
      |                      ^
candies.cpp:8:21: error: 'l' was not declared in this scope
    8 |         for(int j = l[i]; j <= l[i]; ++j) {
      |                     ^
candies.cpp:9:21: error: 'v' was not declared in this scope
    9 |             a[j] += v[i];
      |                     ^