Submission #471271

#TimeUsernameProblemLanguageResultExecution timeMemory
471271almothana05Kisik (COCI19_kisik)C++14
90 / 90
365 ms43920 KiB
// #include<bits\stdc++.h> #include<iostream> #include<algorithm> #include<queue> #include<map> #include<unordered_map> #include<set> #include<cassert> #include<vector> using namespace std; vector<pair<long long , long long > >num , pref; priority_queue<long long>q; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("herding.in", "r", stdin); // freopen("herding.out", "w", stdout); long long menge ,numm , nummer , t , gew , rechner = 0 , erg = 0; cin >> menge >> gew; for(int i = 0 ; i < menge; i++){ cin >> numm >> nummer; num.push_back(make_pair(nummer , numm)); } sort(num.begin() , num.end()); for(int i = 0 ; i < gew ; i++){ q.push(num[i].second); rechner += num[i].second; } erg = rechner * num[gew - 1].first; for(int i = gew ; i < menge ; i++){ rechner -= q.top(); q.pop(); rechner += num[i].second; q.push(num[i].second); erg = min(erg , rechner * num[i].first); } cout << erg; return 0; }

Compilation message (stderr)

kisik.cpp: In function 'int main()':
kisik.cpp:18:35: warning: unused variable 't' [-Wunused-variable]
   18 |  long long menge ,numm , nummer , t , gew , rechner = 0 , erg = 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...