Submission #1163608

#TimeUsernameProblemLanguageResultExecution timeMemory
1163608pearl333Akcija (COCI21_akcija)C++20
0 / 110
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define int long long // i wanna do mathhhhhhh signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,k; cin>>n>>k; int a[n],b[n]; // a is cost, b is time for (int i = 0;i<n;i++) { cin>>a[i]>>b[i]; } sort(b,b+n); priority_queue<int,vector<int>,greater<int>> p; int no = 0, cost = 0, t = 0; for (int i = 2000; i>0;i--) { while (b[t]>=i) { t+=1; p.push(a[t]); } if (p.empty()==false) { no+=1; cost += p.top(); p.pop(); } } cout<<no<<' '<<cost; return 0; }
#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...