Submission #500229

# Submission time Handle Problem Language Result Execution time Memory
500229 2021-12-30T13:31:40 Z sazid_alam Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include "candies.h"

#include <bits/stdc++.h>
using namespace std;
typedef long long int int;

vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    int n = c.size();
    vector<int> s(n, 0) sum(n + 1, 0);

    for(int i = 0; i < (int)v.size(); i++){
        for(int j = l[i]; j <= r[i]; j++){
            if(v[j] > 0) s[j] = min(c[j], s[j] + v[j]);
            else s[j] = max(0, s[j] + v[j]);
        }
    }

    return s;
}

Compilation message

candies.cpp:5:19: error: multiple types in one declaration
    5 | typedef long long int int;
      |                   ^~~
candies.cpp:5:23: error: declaration does not declare anything [-fpermissive]
    5 | typedef long long int int;
      |                       ^~~
candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:10:25: error: expected ',' or ';' before 'sum'
   10 |     vector<int> s(n, 0) sum(n + 1, 0);
      |                         ^~~