제출 #500231

#제출 시각아이디문제언어결과실행 시간메모리
500231sazid_alam사탕 분배 (IOI21_candies)C++17
컴파일 에러
0 ms0 KiB
#include "candies.h" #include <bits/stdc++.h> using namespace std; 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; }

컴파일 시 표준 에러 (stderr) 메시지

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:9:25: error: expected ',' or ';' before 'sum'
    9 |     vector<int> s(n, 0) sum(n + 1, 0);
      |                         ^~~