Submission #139369

# Submission time Handle Problem Language Result Execution time Memory
139369 2019-07-31T15:21:44 Z rzbt Xylophone (JOI18_xylophone) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#include "xylophone.h"
using namespace std;
#define MAXN 5003
int niz[MAXN];

void solve(int n)
{
    niz[1]=1;
    niz[2]=1+query(1,2);
    niz[n]=n;
    for(int i=3;i<n;i++){
        int x=query(i-2,i);
        int y=query(i-1,i);

        if(x==abs(niz[i-1]-niz[i-2])){
            if(niz[i-2]<niz[i-1])niz[i]=niz[i-1]-y;
            else niz[i]=niz[i-1]+y;
        }else{
            if(niz[i-2]<niz[i-1]){
                if(x==y+abs(niz[i-1]-niz[i-2]))niz[i]=niz[i-1]+y;
                else niz[i]=niz[i-1]-y;
            }else{
                if(x==y+abs(niz[i-1]-niz[i-2]))niz[i]=niz[i-1]-y;
                else niz[i]=niz[i-1]+y;
            }

        }
    }
    for(int i=1;i<=n;i++)answer(i,niz[i]);
	return;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -