# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
126985 | 2019-07-08T17:56:46 Z | Lawliet | Sure Bet (CEOI17_sure) | C++14 | 2 ms | 376 KB |
#include <bits/stdc++.h> #define MAX 1010 using namespace std; int n; float ans; float sumA, sumB; float a[MAX]; float b[MAX]; int main() { scanf("%d",&n); for(int g = 1 ; g <= n ; g++) scanf("%f %f",&a[g],&b[g]); sort(a + 1 , a + n + 1); sort(b + 1 , b + n + 1); for(int qtdA = 0 ; qtdA <= n ; qtdA++) { if(qtdA != 0) sumA += a[ n - qtdA + 1 ]; sumB = 0.0; for(int qtdB = 0 ; qtdB <= n ; qtdB++) { if(qtdB != 0) sumB += b[ n - qtdB + 1 ]; float fA = (float) qtdA; float fB = (float) qtdB; float aux; if(sumA > sumB) aux = sumB - fA - fB; else aux = sumA - fA - fB; ans = max(ans , aux); } } printf("%.4lf\n",(double) ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 276 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 276 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Incorrect | 2 ms | 252 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 276 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Incorrect | 2 ms | 252 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |