# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
114969 | IVIosab | Xylophone (JOI18_xylophone) | C++17 | 0 ms | 0 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;
static int A[5000];
int a[5005];
void solve(int N) {
int value = query(1, N);
map<pair<int,int>,int> mp;
for(int i=1;i<n-1;i++){
int t=query(i,i+1);
mp[{i,i+1}]=t;
}
for(int i=1;i<n-2;i++){
int t=query(i,i+2);
if(mp[{i,i+1}]+mp[{i+1,i+2}]==t){
mp[{i,i+2]=1;
}
}
int p1=1,p2=N;
while(p2>p1){
int v=query(p1,p2);
if(v!=value){
p2++;
break;
}
p2--;
}
while(p1<p2){