제출 #1059955

#제출 시각아이디문제언어결과실행 시간메모리
1059955kachim2Cloud Computing (CEOI18_clo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<array<int, 3>> comp(n); for(int i = 0; i < n; i++){ cin >> comp[i][0] >> comp[i][1] >> comp[i][2]; } std::sort(comp.begin(), comp.end()); int m; cin >> m; vector<array<int, 3>> ord(m); for(int i = 0; i < m; i++){ cin >> ord[i][0] >> ord[i][1] >> ord[i][2]; } std::sort(ord.begin(), ord.end()); vector<pair<int, int>> a; vector<int> money; vector<bool> taken(n); int profit = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if(comp[i][1] >= ord[j][1]){ a.push_back(i, ord[j][1]); money.push_back(ord[j][2]); ord[j][1]=INT_MAX; taken[i]=1; } } } while(!a.empty()){ auto x = a.back(); a.pop_back(); taken[x.first] = 0; int mini = x.first; for(int i = 0; i < n; i++){ if(comp[i][1] >= x.second && comp[mini][2]>comp[i][2]){ mini = i; } } taken[mini] = 1; profit+=max(0, money.back()-comp[mini][2]); } cout << profit << '\n'; return 0; }

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

clo.cpp: In function 'int main()':
clo.cpp:28:41: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int&, std::array<int, 3>::value_type&)'
   28 |                 a.push_back(i, ord[j][1]);
      |                                         ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from clo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 2 provided