답안 #739936

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739936 2023-05-11T17:17:45 Z Unforgettablepl Hotel (CEOI11_hot) C++17
20 / 100
594 ms 57516 KB
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const int INF = INT32_MAX;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("measurement.in","r",stdin);
//    freopen("measurement.out","w",stdout);
    ll n,m,o;
    cin >> n >> m >> o;
    vector<pll> rooms(n);
    vector<pll> offers(m);
    for(pll&i:rooms)cin>>i.second>>i.first;
    for(pll&i:offers)cin>>i.first>>i.second;
    set<pll> roomss(all(rooms));
    sort(allr(offers));
    vector<ll> ans;
    for (pll &i: offers) {
        if(!o){ break;}
        // i.first is rate
        // i.second is requirement
        auto room = roomss.lower_bound(make_pair(i.second,(ll)0));
        if(room==roomss.end()){ continue;}
        if(room->second<i.first){
            // Rate is gud
            ans.emplace_back(i.first-room->second);
            roomss.erase(room);
        }
    }
    sort(allr(ans));
    ll anss = 0;
    for (int i = 0; i < o; i++) {
        anss += ans[i];
    }
    cout << anss;
}

Compilation message

hot.cpp: In function 'int main()':
hot.cpp:46:23: warning: comparison of integer expressions of different signedness: 'int' and 'll' {aka 'long long unsigned int'} [-Wsign-compare]
   46 |     for (int i = 0; i < o; i++) {
      |                     ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 5920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 83 ms 17512 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 264 ms 28848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 594 ms 57516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 513 ms 50064 KB Output isn't correct
2 Halted 0 ms 0 KB -