# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
484921 |
2021-11-05T17:57:09 Z |
Bench0310 |
Hotel (CEOI11_hot) |
C++17 |
|
4000 ms |
12028 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n,m,o;
cin >> n >> m >> o;
vector<array<int,2>> ini(n+1,{0,0});
for(int i=1;i<=n;i++) cin >> ini[i][1] >> ini[i][0];
sort(ini.begin(),ini.end());
vector<int> p(n+1,0);
vector<int> c(n+1,0);
for(int i=1;i<=n;i++)
{
p[i]=ini[i][0];
c[i]=ini[i][1];
}
vector<bool> vis(n+1,0);
vector<array<int,2>> v(m);
for(auto &[d,x]:v)
{
cin >> x >> d;
int idx=1;
while(idx<=n&&p[idx]<d) idx++;
d=idx;
}
ll res=0;
while(o)
{
array<int,3> mx={-1,0};
for(int i=0;i<m;i++)
{
auto [d,x]=v[i];
if(d==n+1) continue;
int j=d;
while(j<=n&&vis[j]) j++;
if(j<=n) mx=max(mx,{x-c[j],i,j});
}
auto [r,i,j]=mx;
if(r>=0)
{
res+=r;
v.erase(v.begin()+i);
vis[j]=1;
o--;
m--;
}
else break;
}
cout << res << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4074 ms |
1148 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4093 ms |
1860 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4074 ms |
5180 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4090 ms |
9724 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4057 ms |
12028 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |