Submission #849512

#TimeUsernameProblemLanguageResultExecution timeMemory
849512BenmathSure Bet (CEOI17_sure)C++14
60 / 100
3 ms604 KiB
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; int n; double prvi[1010]; double drugi[1010]; int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> prvi[i]; cin >> drugi[i]; } sort(prvi, prvi+n); sort(drugi,drugi+n); double suma_prva = 0; double suma_druga = 0; double ans = 0; for(int i = n-1; i>=0; i--){ suma_prva = suma_prva + prvi[i]; suma_druga = 0; for(int j = n-1; j>=0; j--){ double broj_prvih = n-i; double broj_drugih = n-j; double ukupan = broj_prvih + broj_drugih; suma_druga = suma_druga + drugi[j]; double rezultat = min(suma_prva - ukupan, suma_druga - ukupan); ans = max(ans, rezultat); } } printf("%.4lf",(double)ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...