# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
63495 | win11905 | Xylophone (JOI18_xylophone) | C++11 | 172 ms | 832 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "xylophone.h"
#include <bits/stdc++.h>
using namespace std;
int n, A[5005];
int getl() {
int l = 1, r = n;
while(l < r) {
int m = l + r + 1>> 1;
if(query(m, n) == n-1) l = m;
r = m-1;
}
return l;
}
int getNum(int a1, int a2, int a, int b) {
if(a > b) {
if(a2 - a1 == a - b) return a + a1;
return a - a1;
} else {
if(a2 - a1 == b - a) return a - a1;
return a + a1;
}
}
void solve(int N) {
n = N;
A[1] = 0, A[2] = query(1, 2);
for(int i = 3; i <= n; ++i) A[i] = getNum(query(i-1, i), query(i-2, i), A[i-1], A[i-2]);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |