이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#include "gap.h"
long long t,n,st,ed,mn,mx,ans=-1e18;
vector<long long> l,r;
long long findGap(int T, int N)
{
t=(long long)T;
n=(long long)N;
if(t==1)
{
st=0;
ed=1e18;
for(int i=1;i<=(n-1)/2+1;i++)
{
//printf("%d\n",i);
MinMax(st,ed,&mn,&mx);
//printf("%lld %lld\n",mn,mx);
l.push_back(mn);
r.push_back(mx);
st=mn+1;
ed=mx-1;
}
/*for(int i=0;i<l.size();i++)
{
printf("%lld ",l[i]);
}
printf("\n");
for(int i=0;i<r.size();i++)
{
printf("%lld ",r[i]);
}
printf("\n");*/
for(int i=1;i<l.size();i++)
{
ans=max(ans,l[i]-l[i-1]);
}
ans=max(ans,r[r.size()-1]-l[l.size()-1]);
for(int i=r.size()-2;i>=0;i--)
{
ans=max(ans,r[i]-r[i+1]);
}
return ans;
}else
{
}
}
컴파일 시 표준 에러 (stderr) 메시지
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:34:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | for(int i=1;i<l.size();i++)
| ~^~~~~~~~~
gap.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
48 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |