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;
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
static int A[5000];
map<pair<int, int>, int> qs;
int ask(int l, int r){
l++; r++;
if(qs[{l, r}])return qs[{l, r}];
return qs[{l, r}] = query(l, r);
}
vector<int> ans;
void solve(int N) {
int ldir = 1;
ans.pb(0);
ans.pb(ask(0, 1));
for(int i = 2; i < N; i++){
if(ask(i-2, i) != ask(i-1, i)+ask(i-2, i-1))ldir = -ldir;
ans.pb(ans.back()+ask(i-1, i)*ldir);
}
//for(auto i: ans)cout << i << endl;
int a = *min_element(ans.begin(), ans.end());
for(auto& i: ans)i-=a-1;
//for(auto i: ans)cout << i << endl;
if(min_element(all(ans)) > max_element(all(ans)))
for(auto& i: ans)i = N+1-i;
//for(auto i: ans)cout << i << endl;
for(int i = 0; i < N; i++) {
answer(i+1, ans[i]);
}
}
Compilation message (stderr)
xylophone.cpp:8:12: warning: 'A' defined but not used [-Wunused-variable]
static int A[5000];
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |