Submission #734473

#TimeUsernameProblemLanguageResultExecution timeMemory
734473rahidilbayramliLet's Win the Election (JOI22_ho_t3)C++17
5 / 100
1 ms300 KiB
#include<bits/stdc++.h> #define ll long long #define vl vector<ll> #define sl set<ll> #define all(v) v.begin(), v.end() #define pb push_back #define s second #define f first #define pll pair<ll, ll> #define pii pair<int, int> using namespace std; int main() { vector<pll>v; ll n, k, i, s = 0, a, b, cnt = 0; cin >> n >> k; for(i = 0; i < n; i++) { cin >> a >> b; v.pb({a, b}); } sort(all(v)); for(const pair<ll, ll>x : v) { if(cnt < k) s += x.f; else break; cnt++; } cout << s << "\n"; }
#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...