# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
677688 | 2023-01-04T07:27:20 Z | mjhmjh1104 | Seesaw (JOI22_seesaw) | C++17 | 72 ms | 264 KB |
#include <cstdio> #include <numeric> #include <algorithm> using namespace std; int n, a[200006]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", a + i); double res = 1 / 0.; for (int i = 0; i < 1 << n; i++) { int l = 0, r = n - 1; long long sum = accumulate(a, a + n, 0LL); int cnt = n; double curr = sum / (double)cnt; double mx = curr, mn = curr; for (int j = 0; j < n; j++) { if (i & 1 << j) sum -= a[l++]; else sum -= a[r--]; cnt--; curr = sum / (double)cnt; mx = max(mx, curr); mn = min(mn, curr); } res = min(res, mx - mn); } printf("%.10f", res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 72 ms | 212 KB | Output is correct |
3 | Correct | 71 ms | 264 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 72 ms | 212 KB | Output is correct |
3 | Correct | 71 ms | 264 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 72 ms | 212 KB | Output is correct |
3 | Correct | 71 ms | 264 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 72 ms | 212 KB | Output is correct |
3 | Correct | 71 ms | 264 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |