답안 #597182

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597182 2022-07-15T16:50:41 Z Trisanu_Das Hotel (CEOI11_hot) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long int

signed main(){
  int n, m, o; cin >> n >> m >> o;
  multiset<pair<int, int> > rooms;
  for(int i = 0; i < n; i++){
    int c, p; cin >> c >> p; rooms.insert({c, p});
  }
  pair<int, int> requests[m];
  for(int i = 0; i < m; i++) cin >> requests[i].first >> requests[i].second;
  sort(requests, requests + m, (pair<int, int> i, pair<int, int>){return i.second > j.second;});
  
  int ans = 0;
  vector<int> choosed;
  
  for(pair<int, int> p : requests){
    int req = p.first, price = p.second;
    auto choice = rooms.lower_bound({req, -1});
    if(choice == rooms.end()) continue;
    if(price > f.second) choosed.push_back(price - f.second);
  }
  sort(choosed.begin(), choosed.end(), greater<int>());
  for(int i = 0; i < o; i++) ans += choosed[i];
  cout << ans << '\n';
}

Compilation message

hot.cpp: In function 'int main()':
hot.cpp:13:48: error: expected primary-expression before 'i'
   13 |   sort(requests, requests + m, (pair<int, int> i, pair<int, int>){return i.second > j.second;});
      |                                                ^
hot.cpp:13:47: error: expected ')' before 'i'
   13 |   sort(requests, requests + m, (pair<int, int> i, pair<int, int>){return i.second > j.second;});
      |                                ~              ^~
      |                                               )
hot.cpp:22:16: error: 'f' was not declared in this scope
   22 |     if(price > f.second) choosed.push_back(price - f.second);
      |                ^