Submission #946705

# Submission time Handle Problem Language Result Execution time Memory
946705 2024-03-14T23:14:38 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());
    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;
}*/



# Verdict Execution time Memory Grader output
1 Runtime error 389 ms 524288 KB Execution killed with signal 9
2 Runtime error 589 ms 524288 KB Execution killed with signal 9
3 Runtime error 584 ms 524288 KB Execution killed with signal 9
4 Runtime error 624 ms 524288 KB Execution killed with signal 9
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Runtime error 804 ms 524288 KB Execution killed with signal 9
7 Runtime error 797 ms 524288 KB Execution killed with signal 9
8 Runtime error 831 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 1268 ms 524288 KB Execution killed with signal 9
12 Runtime error 1258 ms 524288 KB Execution killed with signal 9
13 Runtime error 1286 ms 524288 KB Execution killed with signal 9
14 Runtime error 1222 ms 524288 KB Execution killed with signal 9
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Runtime error 1820 ms 524288 KB Execution killed with signal 9
17 Incorrect 6 ms 2584 KB Output isn't correct
18 Runtime error 1788 ms 524288 KB Execution killed with signal 9
19 Runtime error 1769 ms 524288 KB Execution killed with signal 9
20 Incorrect 2 ms 2580 KB Output isn't correct
21 Execution timed out 2067 ms 524288 KB Time limit exceeded
22 Incorrect 14 ms 2852 KB Output isn't correct
23 Execution timed out 2059 ms 524288 KB Time limit exceeded
24 Incorrect 16 ms 2856 KB Output isn't correct
25 Incorrect 10 ms 2848 KB Output isn't correct
26 Incorrect 14 ms 2848 KB Output isn't correct
27 Incorrect 13 ms 3020 KB Output isn't correct
28 Execution timed out 2082 ms 524288 KB Time limit exceeded
29 Incorrect 13 ms 2856 KB Output isn't correct
30 Incorrect 9 ms 3104 KB Output isn't correct
31 Runtime error 1008 ms 524288 KB Execution killed with signal 9
32 Incorrect 1 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Runtime error 381 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 548 ms 524288 KB Execution killed with signal 9
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Runtime error 758 ms 524288 KB Execution killed with signal 9
7 Runtime error 806 ms 524288 KB Execution killed with signal 9
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Runtime error 821 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 1266 ms 524288 KB Execution killed with signal 9
13 Runtime error 1244 ms 524288 KB Execution killed with signal 9
14 Runtime error 1260 ms 524288 KB Execution killed with signal 9
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Incorrect 4 ms 2580 KB Output isn't correct
17 Incorrect 4 ms 2584 KB Output isn't correct
18 Incorrect 4 ms 2680 KB Output isn't correct
19 Incorrect 4 ms 2580 KB Output isn't correct
20 Incorrect 3 ms 2568 KB Output isn't correct
21 Execution timed out 2122 ms 524288 KB Time limit exceeded
22 Incorrect 13 ms 2856 KB Output isn't correct
23 Incorrect 13 ms 2852 KB Output isn't correct
24 Execution timed out 2099 ms 524288 KB Time limit exceeded
25 Incorrect 10 ms 2848 KB Output isn't correct
26 Execution timed out 2066 ms 524288 KB Time limit exceeded
27 Execution timed out 2094 ms 524288 KB Time limit exceeded
28 Execution timed out 2063 ms 524288 KB Time limit exceeded
29 Incorrect 13 ms 3104 KB Output isn't correct
30 Incorrect 9 ms 2848 KB Output isn't correct
31 Runtime error 1002 ms 524288 KB Execution killed with signal 9
32 Incorrect 1 ms 2644 KB Output isn't correct