이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define ll long long
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
//#define endl "\n"
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define vll vector<ll>
#define bc back()
#define arr array
#define pll vector<pair<ll,ll>>
using namespace std;
template <class _T>
bool chmin(_T &x, const _T &y){
bool f=0;
if (x>y){x=y;f=1;}
return f;
}
template <class _T>
bool chmax(_T &x, const _T &y){
bool f=0;
if (x<y){x=y;f=1;}
return f;
}
const ll inf=1e18+7;
const ll mod=1e9+7;
const ld eps=1e-9;
long long findGap(int t, int n){
ll i,j;
ll a,b,c,d,l,r;
a=1,b=inf;
MinMax(a,b,&c,&d);
vector <ll> v;
v.pb(c),v.pb(d);
r=d,l=c;
ll ans=0;
if(t==1){
for(i=1;i<(n+1)/2;i++){
a=c+1;
b=d-1;
MinMax(a,b,&c,&d);
v.pb(c);
v.pb(d);
}
}
else{
j=(d-c-1)%(n-1);
for(i=l+1;i<r;i+=(r-l-1)/(n-1)){
a=i;
if(j>0){
i++;
j--;
}
b=i+(r-l-1)/(n-1)-1;
MinMax(a,b,&c,&d);
if(c==-1) continue;
v.pb(c);
v.pb(d);
}
}
sort(v.begin(),v.end());
for(i=1;i<v.sz;i++){
ans=max(ans,v[i]-v[i-1]);
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:74:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
74 | for(i=1;i<v.sz;i++){
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |