This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "gap.h"
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
ll t, n;
vector<ll> ve;
long long findGap(int T, int N)
{
t = T;
n = N;
ll a, b;
MinMax(1LL, 1000000000000000000LL, &a, &b);
ll c = (b - a + n - 1) / n;
ll t1 = 1e18;
ll ans = c;
for(ll i = a; i <= b - c + 1; i += c)
{
ll t3, t4;
MinMax(i, i + c - 1, &t3, &t4);
if(t3 != -1)
{
ve.push_back(t3);
ve.push_back(t4);
}
}
for(ll i = 1; i < ve.size(); i++)
{
ans = max(ans, ve[i] - ve[i - 1]);
}
return ans;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for(ll i = 1; i < ve.size(); i++)
| ~~^~~~~~~~~~~
gap.cpp:19:8: warning: unused variable 't1' [-Wunused-variable]
19 | ll t1 = 1e18;
| ^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |