# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
120444 |
2019-06-24T13:37:12 Z |
OptxPrime |
Kisik (COCI19_kisik) |
C++11 |
|
501 ms |
24168 KB |
#include <iostream>
#include <cmath>
#include<vector>
#include <algorithm>
#include <utility>
#include<stack>
#include<queue>
using namespace std;
#define pb push_back
#define mp make_pair
int main()
{
long long n,k,u,v;
vector<pair<long long, long long>> rec;
priority_queue<pair<long long,long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>>pq;
cin>>n>>k;
for(int i=0;i<n;i++){
cin>>u>>v;
rec.pb( mp( u,v ) );
}
sort( rec.begin(), rec.end() );
long long ans;
long long currh=-1,currw=0;
for( int i=0;i<k;i++ ){
currw+=rec[i].first;
currh=max( currh,rec[i].second );
pq.push( mp( rec[i].second, rec[i].first ) );
}
ans=currh*currw;
for( int i=k;i<n;i++ ){
pair<long long,long long> maxx=pq.top();
long long maxh=maxx.first;
if( rec[i].second < maxh ){
currw-=maxx.second;
currw+=rec[i].first;
pq.pop();
pq.push( mp( rec[i].second, rec[i].first ) );
currh=pq.top().first;
ans=min( ans, currw*currh );
}
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
356 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
219 ms |
12372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
316 ms |
18952 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
187 ms |
13592 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
254 ms |
16084 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
501 ms |
24168 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |