답안 #827003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827003 2023-08-16T07:54:49 Z tigran 사탕 분배 (IOI21_candies) C++17
컴파일 오류
0 ms 0 KB
#include "candies.h"

#include <bits/stdc++.h>

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    int n = c.size();
    std::vector<int> s(n);
	int q = l.size();
	int V = 0;
	for (int i = 0; i < q; i++){
		V += v[i];
	}
	for (int i = 0; i < n; i++){
		s[i] = min(c[i], V);
	}
	return s;
}

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:15:10: error: 'min' was not declared in this scope; did you mean 'std::min'?
   15 |   s[i] = min(c[i], V);
      |          ^~~
      |          std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from candies.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~