답안 #946706

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946706 2024-03-14T23:16:25 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)
            continue;

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



# 결과 실행 시간 메모리 Grader output
1 Runtime error 356 ms 524288 KB Execution killed with signal 9
2 Runtime error 539 ms 524288 KB Execution killed with signal 9
3 Runtime error 554 ms 524288 KB Execution killed with signal 9
4 Runtime error 612 ms 524288 KB Execution killed with signal 9
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Runtime error 764 ms 524288 KB Execution killed with signal 9
7 Runtime error 745 ms 524288 KB Execution killed with signal 9
8 Runtime error 778 ms 524288 KB Execution killed with signal 9
9 Execution timed out 3041 ms 2392 KB Time limit exceeded
10 Incorrect 1 ms 2392 KB Output isn't correct
11 Runtime error 1304 ms 524288 KB Execution killed with signal 9
12 Runtime error 1251 ms 524288 KB Execution killed with signal 9
13 Runtime error 1310 ms 524288 KB Execution killed with signal 9
14 Runtime error 1204 ms 524288 KB Execution killed with signal 9
15 Execution timed out 3045 ms 265808 KB Time limit exceeded
16 Runtime error 1911 ms 524288 KB Execution killed with signal 9
17 Execution timed out 3044 ms 2588 KB Time limit exceeded
18 Runtime error 1805 ms 524288 KB Execution killed with signal 9
19 Runtime error 1774 ms 524288 KB Execution killed with signal 9
20 Incorrect 5 ms 2576 KB Output isn't correct
21 Execution timed out 2080 ms 524288 KB Time limit exceeded
22 Execution timed out 3030 ms 2852 KB Time limit exceeded
23 Execution timed out 2055 ms 524288 KB Time limit exceeded
24 Execution timed out 3096 ms 2844 KB Time limit exceeded
25 Execution timed out 3052 ms 134364 KB Time limit exceeded
26 Execution timed out 3025 ms 2852 KB Time limit exceeded
27 Execution timed out 3041 ms 2852 KB Time limit exceeded
28 Execution timed out 2055 ms 524288 KB Time limit exceeded
29 Execution timed out 3053 ms 2852 KB Time limit exceeded
30 Incorrect 22 ms 3096 KB Output isn't correct
31 Runtime error 1004 ms 524288 KB Execution killed with signal 9
32 Runtime error 1494 ms 524288 KB Execution killed with signal 9
# 결과 실행 시간 메모리 Grader output
1 Runtime error 422 ms 524288 KB Execution killed with signal 9
2 Execution timed out 3027 ms 2392 KB Time limit exceeded
3 Execution timed out 3004 ms 2392 KB Time limit exceeded
4 Runtime error 543 ms 524288 KB Execution killed with signal 9
5 Correct 0 ms 2392 KB Output is correct
6 Runtime error 757 ms 524288 KB Execution killed with signal 9
7 Runtime error 860 ms 524288 KB Execution killed with signal 9
8 Execution timed out 3063 ms 2392 KB Time limit exceeded
9 Runtime error 763 ms 524288 KB Execution killed with signal 9
10 Correct 1 ms 2392 KB Output is correct
11 Execution timed out 3074 ms 2392 KB Time limit exceeded
12 Runtime error 1214 ms 524288 KB Execution killed with signal 9
13 Runtime error 1220 ms 524288 KB Execution killed with signal 9
14 Runtime error 1201 ms 524288 KB Execution killed with signal 9
15 Execution timed out 3025 ms 266148 KB Time limit exceeded
16 Execution timed out 3007 ms 2584 KB Time limit exceeded
17 Execution timed out 3041 ms 2576 KB Time limit exceeded
18 Execution timed out 3063 ms 2588 KB Time limit exceeded
19 Execution timed out 3025 ms 2796 KB Time limit exceeded
20 Correct 5 ms 2576 KB Output is correct
21 Execution timed out 2130 ms 524288 KB Time limit exceeded
22 Execution timed out 3042 ms 2856 KB Time limit exceeded
23 Execution timed out 3053 ms 2852 KB Time limit exceeded
24 Execution timed out 2105 ms 524288 KB Time limit exceeded
25 Execution timed out 3046 ms 135888 KB Time limit exceeded
26 Execution timed out 2033 ms 524288 KB Time limit exceeded
27 Execution timed out 2065 ms 524288 KB Time limit exceeded
28 Execution timed out 2083 ms 524288 KB Time limit exceeded
29 Execution timed out 3054 ms 2992 KB Time limit exceeded
30 Correct 22 ms 3096 KB Output is correct
31 Runtime error 1039 ms 524288 KB Execution killed with signal 9
32 Runtime error 1537 ms 524288 KB Execution killed with signal 9