# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
283249 | NintsiChkhaidze | Xylophone (JOI18_xylophone) | C++14 | 113 ms | 384 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 <iostream>
#include <vector>
#include "xylophone.h"
#define pb push_back
#define f first
#define s second
using namespace std;
int ans[5005];
void solve(int N) {
int l=1,r=N,v = N - 1;
while (v == N - 1)
v = query(l,--r);
if (r + 1 <= N && ans[r + 1] == 0) ans[r + 1] = N;
int indn = r + 1;
if (indn - 1 > 0 && ans[indn - 1] == 0){
v = query(indn - 1,indn);
ans[indn - 1] = N - v;
}
if (indn + 1 <= N && ans[indn + 1] == 0){
v = query(indn,indn + 1);
ans[indn + 1] = N - v;
}
int ind = indn - 2;
while (ind > 0 && ans[ind] == 0){
v = query(ind,ind + 1);
int v1 = query(ind,ind + 2),val=0;
if (ans[ind + 1] - v > 0) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |