답안 #546817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
546817 2022-04-08T14:30:51 Z Trisanu_Das 사탕 분배 (IOI21_candies) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
vector<int> distribute_candies(int c[], int l[], int r[], int v[]){
  int n = c.size();
  vector<int> a(n);
  for(int i = 0; i < q; ++i) {
        for(int j = l[i]; j <= l[i]; ++j) {
            a[j] += v[i];
            a[j] = max(a[j], 0); a[j] = min(a[j], c[j]);
        }
    }
    return a;
}

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(int*, int*, int*, int*)':
candies.cpp:5:13: error: request for member 'size' in 'c', which is of non-class type 'int*'
    5 |   int n = c.size();
      |             ^~~~
candies.cpp:7:22: error: 'q' was not declared in this scope
    7 |   for(int i = 0; i < q; ++i) {
      |                      ^