Submission #100528

# Submission time Handle Problem Language Result Execution time Memory
100528 2019-03-12T04:12:58 Z Feeder Kisik (COCI19_kisik) C++11
0 / 90
90 ms 9312 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, k, w, h;
	long long mn, curw = 0;
	vector<pair<int, int> > vec;
	cin >> n >> k;
	for(int i=0; i<k; i++){
		cin >> w >> h;
		vec.push_back(make_pair(h, w));
	}
	priority_queue<int> pq;
	sort(vec.begin(), vec.end());
	for(int i=0; i<k; i++){
		curw += vec[i].second;
		pq.push(vec[i].second);
	}
	mn = min(mn, curw * vec[k-1].first);
	for(int i=k; i<n; i++){
		if(vec[i].second >= pq.top()) continue;
		curw -= pq.top();
		pq.pop();
		curw += vec[i].second;
		pq.push(vec[i].second);
		mn = min(mn, curw * vec[i].first);
	}
	cout << mn;
}

Compilation message

kisik.cpp: In function 'int main()':
kisik.cpp:7:12: warning: 'mn' may be used uninitialized in this function [-Wmaybe-uninitialized]
  long long mn, curw = 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 432 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 2 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 72 ms 7860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 6856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 90 ms 9312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 54 ms 6060 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -