Submission #1032524

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10325242024-07-23 23:41:32vjudge1Xylophone (JOI18_xylophone)C++17
47 / 100
61 ms20908 KiB
#include "xylophone.h"
#include<bits/stdc++.h>
using namespace std;
static int A[5000];
int sv[5010][5010];
int myqry(int l,int r){
if(l==r)return 0;
if(sv[l][r])return sv[l][r];
return sv[l][r]=query(l,r);
}
int ans[5010];
int makesense(int a,int b,int c,int ac){
return ac==max({a,b,c})-min({a,b,c});
}
void solve(int N) {
int l=1,r=N-1,res=0;
while(l<=r){
int mid=l+r>>1;
if(myqry(mid,N)==N-1)
res=mid,l=mid+1;
else r=mid-1;
}
int posof1=res;
ans[posof1]=1;
if(posof1>1)
ans[posof1-1]=myqry(posof1-1,posof1)+1;
ans[posof1+1]=myqry(posof1,posof1+1)+1;
for(int i=posof1-2;i>0;i--){
int k=myqry(i,i+1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:19:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   19 |         int mid=l+r>>1;
      |                 ~^~
xylophone.cpp: At global scope:
xylophone.cpp:4:12: warning: 'A' defined but not used [-Wunused-variable]
    4 | static int A[5000];
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...