Submission #732984

# Submission time Handle Problem Language Result Execution time Memory
732984 2023-04-30T00:46:27 Z 1bin Hotel (CEOI11_hot) C++14
30 / 100
653 ms 51196 KB
#include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()
typedef long long ll;
ll n, m, o, a, b, ans;
set<pair<ll, ll>> s;
vector<ll> arr;

int main(void){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin >> n >> m >> o;
    vector<pair<ll, ll>> O(m);
    for(int i = 0; i < n; i++){
        cin >> a >> b;
        s.emplace(b, a);
    }
    for(auto&t : O) cin >> t.first >> t.second;
    sort(all(O)); reverse(all(O));
    
    for(auto&[v, d] : O){
        auto it = s.lower_bound({d, 0});
        if(it == s.end()) continue;
        a = v - it->second;
        s.erase(it);
        if(a > 0) arr.emplace_back(a);
    }
    sort(all(arr)); reverse(all(arr));
    for(int i = 0; i < min(o, (ll) arr.size()); i++) ans += arr[i];
    cout << ans;
    return 0;
}

Compilation message

hot.cpp: In function 'int main()':
hot.cpp:23:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   23 |     for(auto&[v, d] : O){
      |              ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 5352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 84 ms 9132 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 288 ms 25788 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 653 ms 51196 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 575 ms 42200 KB Output isn't correct
2 Halted 0 ms 0 KB -