Submission #526353

#TimeUsernameProblemLanguageResultExecution timeMemory
526353model_codeLet's Win the Election (JOI22_ho_t3)C++17
11 / 100
11 ms460 KiB
#include <iostream> #include <vector> #include <cassert> #include <algorithm> using namespace std; int N, K; int A[509], B[509]; bool used[509]; double Answer = 1e9; void dfs(int pos, int corp, double ti) { if (pos == K) { Answer = min(Answer, ti); return; } for (int i = 1; i <= N; i++) { if (used[i] == true) continue; used[i] = true; dfs(pos + 1, corp + 0, ti + 1.0 * A[i] / (corp + 1)); if (B[i] != -1) { dfs(pos + 1, corp + 1, ti + 1.0 * B[i] / (corp + 1)); } used[i] = false; } } int main() { // Step #1. Input cin >> N >> K; for (int i = 1; i <= N; i++) cin >> A[i] >> B[i]; assert(N <= 7); // Step #2. Brute Force dfs(0, 0, 0.0); // Step #3. Output printf("%.12lf\n", Answer); 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...