Submission #58358

#TimeUsernameProblemLanguageResultExecution timeMemory
58358khohkoXylophone (JOI18_xylophone)C++17
0 / 100
3 ms308 KiB
#include <bits/stdc++.h> #include "xylophone.h" #pragma GCC optimize("O3") using namespace std; #define ll long long #define pb push_back //#define mp make_pair #define fr first #define sc second #define MAX ((ll)(1e17+100)) #define MX ((ll)(1e5+100)) #define ARRS ((ll)(1e6+100)) #define ARS ((ll)(1e3+100)) #define HS ((ll)(233)) #define MOD ((ll)(1e9+7)) #define EP ((double)(1e-9)) #define LG 21 #define mul(a,b) a=((a)*(b))%MOD using namespace std; ll a[ARRS]; void solve(int n) { ll l,r; for(int i=1; i<=n; i++) if(query(1,i)==n-1){r=i;break;} for(int i=n; i>=1; i--) if(query(i,n)==n-1){l=i;break;} //cout<<l<<" "<<r<<endl; a[l]=1; a[r]=n; for(ll i=1; i<=n; i++){ if(i==l||i==r)continue; if(i<r) a[i]=1+query(min(i,l),max(i,l)); else a[i]=n-query(min(i,r),max(i,r)); } for(int i = 1; i <= n; i++) answer(i, a[i]); }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:32:6: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
  a[l]=1;
  ~~~~^~
xylophone.cpp:33:6: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
  a[r]=n;
  ~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...