#include "xylophone.h"
static int A[5000];
void solve(int N) {
int ni = 1, fi = 2, lv = -1;
while (query(1, ni) != N - 1)ni++;
answer(ni, N);
for (int i = ni + 1; i <= N; i++) {
int qv = query(ni, i);
int v1 = N - qv;
if (qv == lv) {
int qv2 = query(i - 1, i);
v1 += qv2;
}
answer(i, v1);
lv = qv;
}
lv = -1;
for (int i = ni - 1; i >= 1; i--) {
int qv = query(i, ni);
if (qv == N - 1) {
fi = i;
answer(fi, 1);
break;
}
int v1 = N - qv;
if (qv == lv) {
int qv2 = query(i, i + 1);
v1 += qv2;
}
answer(i, v1);
lv = qv;
}
lv = -1;
for (int i = fi - 1; i >= 1; i--) {
int qv1 = query(i, fi), qv2 = query(i, i + 1);
int v1 = 1 + qv1;
if (qv1 == lv) {
v1 -= qv2;
}
answer(i, v1);
lv = qv1;
}
}
Compilation message
xylophone.cpp:3:12: warning: 'A' defined but not used [-Wunused-variable]
static int A[5000];
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |