제출 #490533

#제출 시각아이디문제언어결과실행 시간메모리
490533nickmet2004사탕 분배 (IOI21_candies)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "candies.h"

#define ve vector<int>
using namespace std;
v ans;
ve distribute_candies(ve c, ve l, ve r, ve v){
    int n =c.size() , q = v.size();
    ans.resize(n , 0);
    for(int i = 0; i < q; ++i){
        ans[l[i]] += v[i];
        ans[r[i] + 1] -= v[i];
    }
    for(int i = 1; i < n; ++i) ans[i] += ans[i - 1];
    for(int i = 0;i < n; ++i) ans[i] = min(ans[i] , c[i]);
    return ans;
}

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

candies.cpp:6:1: error: 'v' does not name a type; did you mean 've'?
    6 | v ans;
      | ^
      | ve
candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:9:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |     ans.resize(n , 0);
      |     ^~~
      |     abs