This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
*/
// lethal option
#include "xylophone.h"
#include<bits/stdc++.h>
using namespace std;
#define all(flg) flg.begin(), flg.end()
#define pb push_back
#define fi first
#define se second
#define endl "\n"
#define eb emplace_back
#define ii pair<int, int>
#define vi vector<int>
#define PI 3.141592653589793238462643383279502884
#define ll long long
#define ld long double
#define for1(i, ff, gg) for(int i = ff; i <= gg; ++i)
#define for2(i, ff, gg) for(int i = ff; i >= gg; --i)
const ll mod = 1e9 + 7;
const int maxN = 300005;
const ll oo = 1e18 + 7;
int n, a[maxN];
int x, y, z, k;
int b[maxN];
int arr[maxN];
void solve(int N){
n = N;
for1(i, 1, n - 1) a[i] = query(i, i + 1);
b[1] = 1;
for1(i, 1, n - 2){
if(query(i, i + 2) == a[i] + a[i + 1]) b[i + 1] = b[i];
else b[i + 1] = -b[i];
}
a[n] = 0;
int mn = 0;
for2(i, n - 1, 1){
a[i] = a[i + 1] - b[i] * a[i];
mn = min(mn, a[i]);
}
for1(i, 1, n) a[i] = a[i] - mn + 1;
for1(i, 1, n){
if(a[i] == 1) break;
if(a[i] == n){
for1(i, 1, n) a[i] = n + 1 - a[i];
break;
}
}
for1(i, 1, n) answer(i, a[i]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |