제출 #40881

#제출 시각아이디문제언어결과실행 시간메모리
40881IvanCGap (APIO16_gap)C++14
44.20 / 100
90 ms2660 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; mt19937_64 gen(rand() ^ (rand() << 16)); typedef long long ll; typedef pair<ll,ll> ii; ll NN,TT,maior; ii binary_search(ll ini,ll fim){ if(ini == fim) return ii(ini,ini); ll copia1 = ini,copia2 = fim; MinMax(ini,fim,&copia1,&copia2); ini = copia1; fim = copia2; if(fim - ini <= maior) return ii(ini,fim); ll meio = ini + (gen() % (fim - ini)); ii novo1 = binary_search(ini,meio); ii novo2 = binary_search(meio+1,fim); if(novo1.second != novo2.first) maior = max(maior, novo2.first - novo1.second); return ii(ini,fim); } ll findGap(int T,int N){ TT = T; NN = N; ll ini = 0,fim = (ll)1e18; if(T == 1){ vector<ll> vetor; for(ll qtd = N;qtd >= 1;qtd -= 2){ ll copia1,copia2; MinMax(ini,fim,&copia1,&copia2); vetor.push_back(copia1); vetor.push_back(copia2); ini = copia1; fim = copia2; ini++,fim--; } sort(vetor.begin(),vetor.end()); for(ll i = 0;i+1<vetor.size();i++) maior = max(maior, vetor[i+1] - vetor[i] ); return maior; } binary_search(ini,fim); return maior; }

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

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:37:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(ll i = 0;i+1<vetor.size();i++) maior = max(maior, vetor[i+1] - vetor[i] );
                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...