제출 #1015209

#제출 시각아이디문제언어결과실행 시간메모리
1015209vjudge1Gap (APIO16_gap)C++17
30 / 100
40 ms1896 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define ll long long long long findGap(signed t,signed n) { if (t==2) { ll mn1,mx1; MinMax(0,(ll)1e18,&mn1,&mx1); ll st,mn,mx,ans=0; for (int i=0;i<=60;i++) { MinMax(mn1+1,mn1+(1LL<<i),&mn,&mx); if (mn!=-1) { ans=mn-mn1; st=mx; break; } } while (st<mx1) { MinMax(st+1,st+ans,&mn,&mx); if (mn!=-1) st=mx; else { int val=ans*2; while (1) { MinMax(st+1,st+val,&mn,&mx); if (mn!=-1) { ans=mn-st; st=mx; break; } val*=2; } } } return ans; } else { long long a[n],i=0,j=n-1,lim1=0,lim2=1e18; long long mn,mx; while (i<=j) { MinMax(lim1,lim2,&mn,&mx); a[i++]=mn; a[j--]=mx; lim1=mn+1; lim2=mx-1; } long long ans=0; for (int i=0;i<n-1;i++) ans=max(ans,a[i+1]-a[i]); return ans; } }

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:38:10: warning: 'st' may be used uninitialized in this function [-Wmaybe-uninitialized]
   38 |       ans=mn-st;
      |       ~~~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...