Submission #536806

# Submission time Handle Problem Language Result Execution time Memory
536806 2022-03-14T05:05:13 Z xp875 Let's Win the Election (JOI22_ho_t3) C++17
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll u = 10000;

int main() {
	ll n, k; 
	cin >> n >> k;
	ll a[n], b[n];
	vector<ll> h, nh;
	for(int i=0; i<n; i++) {
		cin >> a[i] >> b[i];
		if(b[i]==-1) nh.push_back(a[i]);
		else h.push_back(a[i]);
	}
	
	sort(h.begin(), h.end());
	sort(nh.begin(), nh.end());

	ll ans = (ll)1<<60;
	for(int i=0; i<min(k, (ll)h.size()); i++) {
		if((ll)h.size()+i<k) continue;
		ll tot = 0, helper = 1;
		for(int j=0; j<i; j++) {
			tot += h[j]*u/helper;
			//cout << h[j] << ' ' << helper << '\n';
			helper ++;
		}
	
		for(int j=i;j<k; j++) {
			tot += nh[j-i]*u/helper;
			//cout << nh[j-i] << '\n';
		}	
		ans = min(tot, ans);
		
	}
	cout << (double)ans/u;
	
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -