답안 #946681

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946681 2024-03-14T22:10:28 Z Ice_man Gap (APIO16_gap) C++14
0 / 100
33 ms 4236 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;


long long findGap(int t , int n)
{
    long long l = 1;
    long long r = LINF;

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

    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 = max(ans , abs(nums[i] - nums[i - 1]));

    return ans;
}






Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:60:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |     for(int i = 1; i < nums.size(); i++)
      |                    ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 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 1 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 0 ms 2392 KB Output isn't correct
8 Incorrect 0 ms 2392 KB Output isn't correct
9 Incorrect 0 ms 2392 KB Output isn't correct
10 Incorrect 0 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2520 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 2840 KB Output isn't correct
17 Incorrect 8 ms 2844 KB Output isn't correct
18 Incorrect 9 ms 2844 KB Output isn't correct
19 Incorrect 8 ms 2840 KB Output isn't correct
20 Incorrect 6 ms 2828 KB Output isn't correct
21 Incorrect 31 ms 3988 KB Output isn't correct
22 Incorrect 29 ms 3996 KB Output isn't correct
23 Incorrect 30 ms 4000 KB Output isn't correct
24 Incorrect 29 ms 3992 KB Output isn't correct
25 Incorrect 26 ms 3992 KB Output isn't correct
26 Incorrect 30 ms 3996 KB Output isn't correct
27 Incorrect 32 ms 4056 KB Output isn't correct
28 Incorrect 29 ms 3992 KB Output isn't correct
29 Incorrect 32 ms 3972 KB Output isn't correct
30 Incorrect 24 ms 3992 KB Output isn't correct
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Incorrect 0 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2544 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 0 ms 2392 KB Output isn't correct
6 Incorrect 0 ms 2392 KB Output isn't correct
7 Incorrect 0 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 2836 KB Output isn't correct
17 Incorrect 8 ms 2840 KB Output isn't correct
18 Incorrect 8 ms 2836 KB Output isn't correct
19 Incorrect 8 ms 2920 KB Output isn't correct
20 Incorrect 6 ms 2832 KB Output isn't correct
21 Incorrect 30 ms 3796 KB Expected int32, but "2500099997" found
22 Incorrect 29 ms 3992 KB Expected int32, but "2500099997" found
23 Incorrect 30 ms 4236 KB Expected int32, but "2500099997" found
24 Incorrect 31 ms 3784 KB Expected int32, but "2500099997" found
25 Incorrect 27 ms 4000 KB Expected int32, but "2500099997" found
26 Incorrect 29 ms 3996 KB Expected int32, but "2500099997" found
27 Incorrect 29 ms 3996 KB Expected int32, but "2500099997" found
28 Incorrect 30 ms 4000 KB Expected int32, but "2500099997" found
29 Incorrect 33 ms 3988 KB Expected int32, but "2500099997" found
30 Incorrect 24 ms 4004 KB Expected int32, but "2500099997" found
31 Incorrect 1 ms 2392 KB Output isn't correct
32 Incorrect 0 ms 2392 KB Output isn't correct