제출 #683927

#제출 시각아이디문제언어결과실행 시간메모리
683927abcdehelloGap (APIO16_gap)C++17
59.12 / 100
58 ms3356 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll findGap(int T, int N) { ll mn,mx; MinMax(1,1LL<<60,&mn,&mx); vector<ll> a(0); ll ans=-1; if (T==1){ a.push_back(mn);a.push_back(mx); while (mn<mx){ MinMax(mn+1,mx-1,&mn,&mx); if (mn!=-1) a.push_back(mn); if (mx!=-1) a.push_back(mx); } } else{ ll gmn=mn,gmx=mx,rng=(mx-mn+N-2)/(N-1); a.push_back(mn);a.push_back(mx); gmn++; while (gmn<gmx){ MinMax(gmn,gmn+rng,&mn,&mx); if (mn!=-1) a.push_back(mn); if (mx!=-1) a.push_back(mx); gmn+=rng; } } sort(a.begin(),a.end()); for (int i=1;i<a.size();i++){ ans=max(ans,a[i]-a[i-1]); } return ans; return 0; }

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

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:31:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for (int i=1;i<a.size();i++){
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...