# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
155135 | 2019-09-26T16:02:02 Z | karma | Xylophone (JOI18_xylophone) | C++14 | 2 ms | 324 KB |
#include "xylophone.h" #include<bits/stdc++.h> #define ll long long using namespace std; const int N = 6006; int a[N], d[2][N], mx, mn, up; void solve(int n) { a[0] = 0; for(int i = 1; i < n; ++i) d[1][i - 1] = query(i, i + 1); for(int i = 2; i < n; ++i) d[2][i - 2] = query(i - 1, i + 1); a[1] = d[1][0]; up = 1; for(int i = 2; i < n; ++i) { if(d[1][i - 1] + d[1][i - 2] != d[2][i - 2]) up ^= 1; a[i] = a[i - 1] + (2 * up - 1) * d[1][i - 1]; } mx = mn = 0; for(int i = 1; i < n; ++i) { if(a[mx] < a[i]) mx = i; if(a[mn] > a[i]) mn = i; } if(mn < mx) { mn = a[mn]; for(int i = 0; i < n; ++i) answer(i + 1, a[i] - mn + 1); } else { mx = a[mx]; for(int i = 0; i < n; ++i) answer(i + 1, mx - a[i] + 1); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 252 KB | Output is correct |
3 | Incorrect | 2 ms | 324 KB | Wrong Answer [7] |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 252 KB | Output is correct |
3 | Incorrect | 2 ms | 324 KB | Wrong Answer [7] |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 252 KB | Output is correct |
3 | Incorrect | 2 ms | 324 KB | Wrong Answer [7] |
4 | Halted | 0 ms | 0 KB | - |