답안 #549449

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
549449 2022-04-15T20:15:33 Z kilikuma 사탕 분배 (IOI21_candies) C++17
컴파일 오류
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();
      |           ^