# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
228985 | bharat2002 | Xylophone (JOI18_xylophone) | C++14 | 5 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<bits/stdc++.h>
#include "xylophone.h"
using namespace std;
const int N=1e5+10;
int arr[N], ans[N];
void solve(int n)
{
for(int i=2;i<=n;i++)
{
arr[i]=query(i-1, i);
}
int ind;
for(int i=2;i<=n;i++)
{
int temp=query(1, i);
if(temp==n-1) {ans[i]=n;ind=i;break;}
}
for(int i=ind+1;i<=n;i++)
{
ans[i]=ans[i-1]+arr[i];
}
for(int i=ind-1;i>=1;i--)
{
ans[i]=ans[i+1]-arr[i];
}
for(int i=1;i<=n;i++) answer(i, ans[i]);
}
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... |