#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
#include "gap.h"
#define maxn 200005
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cout<<"passed"<<endl;
#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")
using namespace std;
std::chrono::high_resolution_clock::time_point startT, currT;
constexpr double TIME_MULT = 1;
double timePassed()
{
using namespace std::chrono;
currT = high_resolution_clock::now();
double time = duration_cast<duration<double>>(currT - startT).count();
return time * TIME_MULT;
}
vector <long long> nums;
/**void MinMax(long long l , long long r , long long &mn , long long &mx)
{
cout << l << " " << r << endl;
int a , b;
cin >> a >> b;
mn = a;
mx = b;
}*/
long long findGap(int t , int n)
{
long long l = 1;
long long r = LINF;
long long maxx = -1;
long long minn = LINF;
MinMax(1LL , LINF , &minn , &maxx);
long long step = (maxx - minn + n) / n;
l = minn;
r = maxx;
nums.pb(minn);
for(long long i = l; i < r; i += step)
{
long long to = min(r - 1 , i + step);
MinMax(i + 1 , to , &minn , &maxx);
if(minn == -1 && maxx == -1)
continue;
nums.pb(minn);
nums.pb(maxx);
}
nums.pb(r);
//sort(nums.begin() , nums.end());
//reverse(nums.begin() , nums.end());
long long ans = -1;
for(int i = 1; i < (int)(nums.size()); i++)
ans = max(ans , abs(nums[i] - nums[i - 1]));
return ans;
}
/**int main()
{
int t , n;
cin >> t >> n;
cout << findGap(t , n) << endl;;
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
500 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
16 |
Incorrect |
10 ms |
2964 KB |
Output isn't correct |
17 |
Incorrect |
10 ms |
2904 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
2904 KB |
Output isn't correct |
19 |
Incorrect |
10 ms |
2964 KB |
Output isn't correct |
20 |
Incorrect |
5 ms |
2568 KB |
Output isn't correct |
21 |
Incorrect |
40 ms |
3988 KB |
Output isn't correct |
22 |
Incorrect |
41 ms |
3992 KB |
Output isn't correct |
23 |
Incorrect |
46 ms |
3988 KB |
Output isn't correct |
24 |
Incorrect |
40 ms |
3992 KB |
Output isn't correct |
25 |
Incorrect |
38 ms |
5012 KB |
Output isn't correct |
26 |
Incorrect |
39 ms |
3992 KB |
Output isn't correct |
27 |
Incorrect |
40 ms |
4232 KB |
Output isn't correct |
28 |
Incorrect |
40 ms |
4000 KB |
Output isn't correct |
29 |
Incorrect |
39 ms |
3996 KB |
Output isn't correct |
30 |
Incorrect |
21 ms |
3108 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
0 ms |
2392 KB |
Output is correct |
4 |
Correct |
2 ms |
2392 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
1 ms |
2392 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
0 ms |
2392 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2392 KB |
Output is correct |
12 |
Correct |
1 ms |
2392 KB |
Output is correct |
13 |
Correct |
1 ms |
2392 KB |
Output is correct |
14 |
Correct |
1 ms |
2388 KB |
Output is correct |
15 |
Correct |
1 ms |
2392 KB |
Output is correct |
16 |
Correct |
10 ms |
2964 KB |
Output is correct |
17 |
Correct |
10 ms |
2960 KB |
Output is correct |
18 |
Correct |
10 ms |
2964 KB |
Output is correct |
19 |
Correct |
10 ms |
2904 KB |
Output is correct |
20 |
Correct |
5 ms |
2576 KB |
Output is correct |
21 |
Correct |
39 ms |
3992 KB |
Output is correct |
22 |
Correct |
40 ms |
3996 KB |
Output is correct |
23 |
Correct |
41 ms |
4004 KB |
Output is correct |
24 |
Correct |
39 ms |
3996 KB |
Output is correct |
25 |
Correct |
38 ms |
5016 KB |
Output is correct |
26 |
Correct |
40 ms |
3792 KB |
Output is correct |
27 |
Correct |
39 ms |
4252 KB |
Output is correct |
28 |
Correct |
44 ms |
3984 KB |
Output is correct |
29 |
Correct |
44 ms |
3996 KB |
Output is correct |
30 |
Correct |
24 ms |
3104 KB |
Output is correct |
31 |
Correct |
0 ms |
2392 KB |
Output is correct |
32 |
Correct |
0 ms |
2392 KB |
Output is correct |