Submission #946703

# Submission time Handle Problem Language Result Execution time Memory
946703 2024-03-14T23:13:00 Z Ice_man Gap (APIO16_gap) C++14
0 / 100
2000 ms 524288 KB
#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);
    nums.pb(maxx);

    for(int 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)
            break;

        nums.pb(minn);
        nums.pb(maxx);
    }

    sort(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;
}*/



# Verdict Execution time Memory Grader output
1 Runtime error 483 ms 524288 KB Execution killed with signal 9
2 Runtime error 579 ms 524288 KB Execution killed with signal 9
3 Runtime error 593 ms 524288 KB Execution killed with signal 9
4 Runtime error 614 ms 524288 KB Execution killed with signal 9
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Runtime error 820 ms 524288 KB Execution killed with signal 9
7 Runtime error 781 ms 524288 KB Execution killed with signal 9
8 Runtime error 801 ms 524288 KB Execution killed with signal 9
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Incorrect 1 ms 2392 KB Output isn't correct
11 Runtime error 1266 ms 524288 KB Execution killed with signal 9
12 Runtime error 1278 ms 524288 KB Execution killed with signal 9
13 Runtime error 1290 ms 524288 KB Execution killed with signal 9
14 Runtime error 1241 ms 524288 KB Execution killed with signal 9
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Runtime error 1856 ms 524288 KB Execution killed with signal 9
17 Incorrect 3 ms 2588 KB Output isn't correct
18 Runtime error 1782 ms 524288 KB Execution killed with signal 9
19 Runtime error 1789 ms 524288 KB Execution killed with signal 9
20 Incorrect 2 ms 2568 KB Output isn't correct
21 Execution timed out 2077 ms 524288 KB Time limit exceeded
22 Incorrect 13 ms 3100 KB Output isn't correct
23 Execution timed out 2112 ms 524288 KB Time limit exceeded
24 Incorrect 12 ms 2848 KB Output isn't correct
25 Incorrect 9 ms 2852 KB Output isn't correct
26 Incorrect 12 ms 2852 KB Output isn't correct
27 Incorrect 12 ms 2848 KB Output isn't correct
28 Execution timed out 2079 ms 524288 KB Time limit exceeded
29 Incorrect 13 ms 2852 KB Output isn't correct
30 Incorrect 9 ms 2848 KB Output isn't correct
31 Runtime error 1006 ms 524288 KB Execution killed with signal 9
32 Incorrect 0 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Runtime error 399 ms 524288 KB Execution killed with signal 9
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Runtime error 564 ms 524288 KB Execution killed with signal 9
5 Incorrect 0 ms 2392 KB Output isn't correct
6 Runtime error 758 ms 524288 KB Execution killed with signal 9
7 Runtime error 805 ms 524288 KB Execution killed with signal 9
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Runtime error 840 ms 524288 KB Execution killed with signal 9
10 Incorrect 1 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Runtime error 1243 ms 524288 KB Execution killed with signal 9
13 Runtime error 1247 ms 524288 KB Execution killed with signal 9
14 Runtime error 1230 ms 524288 KB Execution killed with signal 9
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Incorrect 3 ms 2588 KB Output isn't correct
17 Incorrect 4 ms 2576 KB Output isn't correct
18 Incorrect 4 ms 2752 KB Output isn't correct
19 Incorrect 4 ms 2584 KB Output isn't correct
20 Incorrect 2 ms 2568 KB Output isn't correct
21 Execution timed out 2121 ms 524288 KB Time limit exceeded
22 Incorrect 12 ms 2852 KB Output isn't correct
23 Incorrect 12 ms 2852 KB Output isn't correct
24 Execution timed out 2103 ms 524288 KB Time limit exceeded
25 Incorrect 10 ms 2848 KB Output isn't correct
26 Execution timed out 2047 ms 524288 KB Time limit exceeded
27 Execution timed out 2072 ms 524288 KB Time limit exceeded
28 Execution timed out 2049 ms 524288 KB Time limit exceeded
29 Incorrect 12 ms 2860 KB Output isn't correct
30 Incorrect 9 ms 3052 KB Output isn't correct
31 Runtime error 965 ms 524288 KB Execution killed with signal 9
32 Incorrect 1 ms 2392 KB Output isn't correct