이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
vector<long long> v;
long long findGap(int m, int n)
{
if(m == 1)
{
int sz = 0;
long long s = -1, t = 2e18, mn, mx, ans = 0;
MinMax(s, t, &mn, &mx);
v.push_back(mn);
v.push_back(mx);
s = mn+1;
t = mx-1;
sz = 2;
while(true)
{
if(sz == n) break ;
MinMax(s, t, &mn, &mx);
v.push_back(mn);
sz++;
if(sz == n) break ;
if(mn != mx)
{
v.push_back(mx);
sz++;
}
if(sz == n) break ;
s = mn+1, t = mx-1;
if(s > t) break ;
}
assert(v.size() == n);
sort(v.begin(), v.end());
for(int i=1 ; i<v.size() ; i++)
ans = max(ans, v[i] - v[i-1]);
return ans;
}
else
{
}
}
컴파일 시 표준 에러 (stderr) 메시지
In file included from /usr/include/c++/9/cassert:44,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
from gap.cpp:1:
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:35:19: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
35 | assert(v.size() == n);
| ~~~~~~~~~^~~~
gap.cpp:37:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
37 | for(int i=1 ; i<v.size() ; i++)
| ~^~~~~~~~~
gap.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
45 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |