제출 #827003

#제출 시각아이디문제언어결과실행 시간메모리
827003tigran사탕 분배 (IOI21_candies)C++17
컴파일 에러
0 ms0 KiB
#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; }

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

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)
      |     ^~~