이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/// gap
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
long long findGap(int T, int N)
{
long long s = 0, t = (long long)1e18;
long long mn, mx;
vector < long long > fh, sh;
while(mn < mx)
{
cout << mn << " " << mx << endl;
MinMax(s, t, &mn, &mx);
if(mn == -1)break;
if(mn == mx)
{
fh.push_back(mn);
break;
}
if(mn > mx)break;
fh.push_back(mn);
sh.push_back(mx);
s = mn + 1;
t = mx - 1;
}
reverse(sh.begin(), sh.end());
long long ans = 0;
for (int i = 1; i < fh.size(); ++ i)
ans = max(ans, fh[i] - fh[i-1]);
ans = max(ans, sh[0] - fh.back());
for (int i = 1; i < sh.size(); ++ i)
ans = max(ans, sh[i] - sh[i-1]);
//cout << ans << endl;
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for (int i = 1; i < fh.size(); ++ i)
| ~~^~~~~~~~~~~
gap.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for (int i = 1; i < sh.size(); ++ i)
| ~~^~~~~~~~~~~
gap.cpp:12:11: warning: 'mn' is used uninitialized in this function [-Wuninitialized]
12 | while(mn < mx)
| ~~~^~~~
gap.cpp:12:11: warning: 'mx' is used uninitialized in this function [-Wuninitialized]
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |