답안 #549592

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
549592 2022-04-16T05:27:37 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; i ++)
    S.push_back(0);
  for (int i = 0; i < Q; i ++) {
    S[l[i]] += v[i];
    if (r[i] + 1 != N)
      S[r[i] + 1] -= v[i];
  }
  for (int i = 1; i < N; i ++)
    S[i] += S[i - 1];
  for (int i = 0; i < N; i ++)
    S[i] = min(S[i], c[i]); 
  return S;
}

Compilation message

candies.cpp:13:13: error: extended character   is not valid in an identifier
   13 |     if (r[i] + 1 != N)
      |             ^
candies.cpp:17:9: error: extended character   is not valid in an identifier
   17 |     S[i] += S[i - 1];
      |         ^
candies.cpp:19:9: error: extended character   is not valid in an identifier
   19 |     S[i] = min(S[i], c[i]);
      |         ^
candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:13:13: error: expected ')' before '\U000000a0'
   13 |     if (r[i] + 1 != N)
      |        ~    ^
      |             )
candies.cpp:17:9: error: expected ';' before '\U000000a0'
   17 |     S[i] += S[i - 1];
      |         ^
      |         ;
candies.cpp:19:9: error: expected ';' before '\U000000a0'
   19 |     S[i] = min(S[i], c[i]);
      |         ^
      |         ;