제출 #548087

#제출 시각아이디문제언어결과실행 시간메모리
548087joshjmsGap (APIO16_gap)C++17
30 / 100
47 ms2320 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define fi first #define se second #define debug(x) cout << #x << " => " << x << "\n"; ll t, n, ans; ll l, r, mn, mx; vector <ll> vect; ll findGap(int T, int N) { t = T, n = N; l = 0, r = 1e18; while(vect.size() < n) { MinMax(l, r, &mn, &mx); vect.pb(mn); if(mn != mx) vect.pb(mx); l = mn + 1; r = mx - 1; } sort(vect.begin(), vect.end()); for(int i = 0; i < vect.size() - 1; i++) ans = max(ans, vect[i + 1] - vect[i]); return ans; }

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

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:20:23: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   20 |     while(vect.size() < n) {
      |           ~~~~~~~~~~~~^~~
gap.cpp:28:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i = 0; i < vect.size() - 1; i++)
      |                    ~~^~~~~~~~~~~~~~~~~
gap.cpp:28:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   28 |     for(int i = 0; i < vect.size() - 1; i++)
      |     ^~~
gap.cpp:30:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |  return ans;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...