Submission #946684

# Submission time Handle Problem Language Result Execution time Memory
946684 2024-03-14T22:16:02 Z Ice_man Gap (APIO16_gap) C++14
0 / 100
38 ms 4252 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;

    int q = ((n + 1) / 2);

    while(q--)
    {
        long long mn , mx;
        MinMax(l , r , &mn , &mx);

        nums.pb(mn);
        nums.pb(mn);

        l = mn + 1;
        r = mx - 1;
    }

    sort(nums.begin() , nums.end());

    long long ans = LINF;

    for(int i = 1; i < nums.size(); i++)
        ans = min(ans , abs(nums[i] - nums[i - 1]));

    return ans;
}


/**int main()
{
    int t , n;
    cin >> t >> n;
    findGap(t , n);

    return 0;
}*/



Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:70:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |     for(int i = 1; i < nums.size(); i++)
      |                    ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 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 8 ms 2844 KB Output isn't correct
17 Incorrect 8 ms 2836 KB Output isn't correct
18 Incorrect 10 ms 2836 KB Output isn't correct
19 Incorrect 8 ms 2844 KB Output isn't correct
20 Incorrect 7 ms 2824 KB Output isn't correct
21 Incorrect 30 ms 3972 KB Output isn't correct
22 Incorrect 31 ms 3996 KB Output isn't correct
23 Incorrect 30 ms 3992 KB Output isn't correct
24 Incorrect 38 ms 3996 KB Output isn't correct
25 Incorrect 27 ms 3996 KB Output isn't correct
26 Incorrect 29 ms 3992 KB Output isn't correct
27 Incorrect 30 ms 3936 KB Output isn't correct
28 Incorrect 35 ms 4252 KB Output isn't correct
29 Incorrect 30 ms 3996 KB Output isn't correct
30 Incorrect 27 ms 3992 KB Output isn't correct
31 Incorrect 0 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2392 KB Output isn't correct
2 Incorrect 0 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 0 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 2644 KB Output isn't correct
12 Incorrect 1 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2484 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 2840 KB Output isn't correct
17 Incorrect 7 ms 2840 KB Output isn't correct
18 Incorrect 8 ms 2840 KB Output isn't correct
19 Incorrect 10 ms 2832 KB Output isn't correct
20 Incorrect 6 ms 2828 KB Output isn't correct
21 Incorrect 35 ms 3988 KB Expected int32, but "2500100000" found
22 Incorrect 35 ms 3996 KB Expected int32, but "2500100000" found
23 Incorrect 30 ms 3804 KB Expected int32, but "2500100000" found
24 Incorrect 31 ms 3992 KB Expected int32, but "2500100000" found
25 Incorrect 27 ms 3984 KB Expected int32, but "2500100000" found
26 Incorrect 32 ms 3984 KB Expected int32, but "2500100000" found
27 Incorrect 31 ms 3996 KB Expected int32, but "2500100000" found
28 Incorrect 30 ms 3908 KB Expected int32, but "2500100000" found
29 Incorrect 32 ms 3924 KB Expected int32, but "2500100000" found
30 Incorrect 26 ms 3812 KB Expected int32, but "2500100000" found
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct