답안 #530563

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
530563 2022-02-25T20:29:37 Z FelipeH Hotel (CEOI11_hot) C++14
0 / 100
746 ms 19228 KB
#include<bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;

vector<int> roomSize, roomCost;
vector<pii> offer;

int main(){
  int n, m, o; cin >> n >> m >> o;
  for(int i = 0;i<n;i++){
    int a, b; cin >> a >> b;
    roomCost.push_back(a); roomSize.push_back(b);
  }
  sort(roomCost.begin(),roomCost.end());
  sort(roomSize.begin(),roomSize.end());
  for(int i = 0;i<m;i++){
    int a, b; cin >> a >> b;
    offer.push_back(make_pair(a,b));
  }
  sort(offer.begin(),offer.end());
  int resp = 0;
  for(int i = offer.size() - 1; i >= 0 && offer.size() - i <= o; i--){
    int roomId = lower_bound(roomSize.begin(), roomSize.end(), offer[i].second) - roomSize.begin();
    resp += offer[i].first - roomCost[roomId];
    roomCost.erase(roomCost.begin() + roomId); roomSize.erase(roomSize.begin() + roomId);
  }
  cout << resp << "\n";
  return 0;
}

Compilation message

hot.cpp: In function 'int main()':
hot.cpp:22:60: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |   for(int i = offer.size() - 1; i >= 0 && offer.size() - i <= o; i--){
      |                                           ~~~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 420 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 1348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 70 ms 3492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 137 ms 5720 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 356 ms 9808 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 692 ms 16808 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 746 ms 19228 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -