제출 #1328527

#제출 시각아이디문제언어결과실행 시간메모리
1328527tomthuy123Let's Win the Election (JOI22_ho_t3)C++20
5 / 100
1 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long double
const ll MOD = 1e9 + 7;

ll AllNegative=1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	
	ll n,k;
	cin >> n >> k;
	vector<pair<ll,ll>> lst(n+1);
	for(ll i=1;i<=n;i++){
		cin >> lst[i].first >> lst[i].second;
		if(lst[i].second!=-1) AllNegative=0;
	}
	sort(lst.begin(),lst.end());
	ll total=0;
	//cout << AllNegative << "\n";
	for(ll i=1;i<=k;i++){
		if(AllNegative==1){
			total+=lst[i].first;
		}
		else{
			total+=lst[i].first/i;
		}
	}
	cout << total;
	

	
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...