Submission #549449

# Submission time Handle Problem Language Result Execution time Memory
549449 2022-04-15T20:15:33 Z kilikuma Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "candies.h"

using namespace std;
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
  int N = c.size();
  int Q = l.size();
  vector<int> S;
  for (int i = 0; i < N + 1; i ++)
    S.push_back(0);
  for (int i = 0; i < Q; i ++) {
    for (int j = l[i]; j <= r[i]; j ++) {
      if (v[i] < 0)
        S[j] = min(c[j], S[j] + v[i]);
      else
        S[j] = max(0, S[j] + v[i]);
    }
  }
  return S;
}

Compilation message

candies.cpp:5:12: error: extended character   is not valid in an identifier
    5 | vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
      |            ^
candies.cpp:5:59: error: extended character   is not valid in an identifier
    5 | vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
      |                                                          ^
candies.cpp: In function 'std::vector<int> \U000000a0distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:7:11: error: 'l' was not declared in this scope
    7 |   int Q = l.size();
      |           ^