# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743070 | 2023-05-17T07:44:52 Z | Dan4Life | Hotel (CEOI11_hot) | C++17 | 4000 ms | 32048 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define sz(a) (int)a.size() const int mxN = (int)5e5+10; using ar = array<int,2>; int n, m, k; ar a[mxN], b[mxN]; bool taken[mxN], taken2[mxN]; int32_t main(){ cin >> n >> m >> k; for(int i = 0; i < n; i++) cin >> a[i][1] >> a[i][0]; for(int i = 0; i < m; i++) cin >> b[i][1] >> b[i][0]; sort(a,a+n), sort(b,b+m); int ans = 0; while(k--){ int mx = 0, I, J; for(int i = 0; i < n; i++){ if(taken[i]) continue; for(int j = 0; j < m; j++){ if(taken2[j]) continue; if(a[i][0] < b[j][0]) continue; if(mx<=b[j][1]-a[i][1]) mx = b[j][1]-a[i][1], I=i,J=j; } } if(!mx) break; ans+=mx; taken[I]=taken2[J]=1; } cout << ans; }
Compilation message
# | 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 | 340 KB | Output is correct |
2 | 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 | 1 ms | 304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 308 KB | Output is correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4018 ms | 876 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4019 ms | 3084 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4009 ms | 5080 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4026 ms | 14196 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4006 ms | 28104 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4091 ms | 32048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |