제출 #569663

#제출 시각아이디문제언어결과실행 시간메모리
569663ali22413836Gap (APIO16_gap)C++14
컴파일 에러
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> #define endl "\n" using namespace std ; typedef long long ll; typedef long double ld ; const int N=2e7; const ll inf=1e18 ; const ll mod = 1e9 + 7 ; ll mypower(ll x, ll y){ if(y == 0) return 1 ; if(y == 1) return x ; ll ret = mypower(x , y / 2); ret = (ret * ret) % mod; if(y % 2) ret = ( ret * x ) % mod ; return ret ; } map < ll , ll > mp ; vector < ll > v ; long long findGap(int T, int N) { ll mn = -1 , mx = 1e18 ; if(T == 1){ ll l = -1 , r = 1e18 + 1 ; while(v.size() != N){ MinMax(l , r , &mn , &mx) ; if(mn == -1 && mx == -1){ break ; } if(mp.count(mn) == 0){ mp[mn] = 1 ; v.push_back(mn) ; l = mn + 1 ; } if(mp.count(mx) == 0){ mp[mx] = 1 ; v.push_back(mx) ; r = mx - 1; } } sort(v.begin() , v.end()) ; ll ans = 0 ; for(int i = 1 ; i < N ; i++){ ans = max(ans , v[i] - v[i - 1]) ; } return ans ; } else{ MinMax(mn , mx , &mn , &mx) ; ll len = (mx - mn + 1) / (n - 1) ; ll q = mn ; ll ans = 0 ; for(int i = mn ; i < mx ; i+= len){ MinMax(i , i + len , &mn , &mx) ; if(mn != -1){ ans = max(ans , mn - q) ; q = mx ; } } return ans ; } }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:25:24: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |         while(v.size() != N){
      |               ~~~~~~~~~^~~~
gap.cpp:50:35: error: 'n' was not declared in this scope; did you mean 'mn'?
   50 |         ll len = (mx - mn + 1) / (n - 1) ;
      |                                   ^
      |                                   mn