제출 #105756

#제출 시각아이디문제언어결과실행 시간메모리
105756Pro_ktmrGap (APIO16_gap)C++14
50.50 / 100
126 ms4452 KiB
#include"bits/stdc++.h" using namespace std; #define LL long long #define REP(i, n) for(int (i)=0; (i)<(n); (i)++) #define PB push_back #define MP make_pair #define MOD 1000000007 #include"gap.h" //MinMax(LL s, LL t, LL& mn, LL& mx) //aiのうちs以上の最小の数がmnに、aiのうちt以下の最大値がmxに格納される //aiの差分のうち最大のものを返す LL findGap(int T, int N){ if(T == 1){ LL m = 0LL; LL M = 1000000000000000000LL; vector<LL> v; for(int i=0; i<(N+1)/2; i++){ LL tmp1, tmp2; MinMax(m, M, &tmp1, &tmp2); v.PB(tmp1); v.PB(tmp2); m = tmp1+1; M = tmp2-1; } sort(v.begin(), v.end()); LL ans = 0; for(int i=1; i<v.size(); i++){ ans = max(ans, v[i] - v[i-1]); } return ans; } if(T == 2){ LL B = 1000000000000000001LL / N; queue<pair<LL, LL>> kukan; for(LL i=0; i<=1000000000000000000LL; i+=B){ kukan.push(MP(i,i+B-1)); } vector<LL> v; while(kukan.size() > 0){ LL m = kukan.front().first; LL M = kukan.front().second; kukan.pop(); LL tmp1, tmp2; MinMax(m, M, &tmp1, &tmp2); if(tmp1 == -1) continue; v.PB(tmp1); if(tmp1 == tmp2) continue; v.PB(tmp2); B = (tmp2 - tmp1) / 5 + 1; for(LL i=tmp1+1; i<=tmp2-1; i+=B){ kukan.push(MP(i, min(i+B-1,tmp2-1))); } } sort(v.begin(), v.end()); LL ans = 0; for(int i=1; i<v.size(); i++){ ans = max(ans, v[i] - v[i-1]); } return ans; } }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=1; i<v.size(); i++){
                ~^~~~~~~~~
gap.cpp:62:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=1; i<v.size(); i++){
                ~^~~~~~~~~
gap.cpp:67:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...