답안 #490533

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
490533 2021-11-27T20:23:09 Z nickmet2004 사탕 분배 (IOI21_candies) C++17
컴파일 오류
0 ms 0 KB
#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;
}

Compilation message

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