Submission #228985

#TimeUsernameProblemLanguageResultExecution timeMemory
228985bharat2002Xylophone (JOI18_xylophone)C++14
0 / 100
5 ms384 KiB
#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)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:12:6: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int ind;
      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...