Submission #1135325

#TimeUsernameProblemLanguageResultExecution timeMemory
1135325ramzialoulouLet's Win the Election (JOI22_ho_t3)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; #ifdef Ramzi #include "debug.h" #else #define debug(...) #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, k; cin >> n >> k; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) { cin >> a[i].second >> a[i].first; } sort(a.begin(), a.end()); multiset<pair<int, int>> se(a.begin(), a.end()); double ans = 0; int x = 0; for (auto [f, s] : a) { if (f != -1) { ans += f; x += 1; se.erase(se.find({f, s})); break; } } double sum = 0; for (auto [f, s] : se) { sum += s; } ans += sum / (x + 1); cout << fixed << setprecision(10) << ans << "\n"; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...