Submission #939851

#TimeUsernameProblemLanguageResultExecution timeMemory
939851TAhmed33Let's Win the Election (JOI22_ho_t3)C++98
11 / 100
2583 ms444 KiB
#include <bits/stdc++.h> using namespace std; typedef long double ld; int n, k, a[501], b[501]; ld recurse (int mask, int c, int l) { if (l == k) return 0; ld ret = 1e18; for (int i = 0; i < n; i++) { if (mask & (1 << i)) continue; ret = min(ret, 1.0 * a[i] / c + recurse(mask ^ (1 << i), c, l + 1)); if (b[i] != -1) ret = min(ret, 1.0 * b[i] / c + recurse(mask ^ (1 << i), c + 1, l + 1)); } return ret; } int main () { cin >> n >> k; for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; cout << fixed << setprecision(9) << recurse(0, 1, 0) << '\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...