답안 #946707

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946707 2024-03-14T23:18:46 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);
    
    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);
    }
    
    nums.pb(r);
    
    //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 345 ms 524288 KB Execution killed with signal 9
2 Runtime error 554 ms 524288 KB Execution killed with signal 9
3 Runtime error 537 ms 524288 KB Execution killed with signal 9
4 Runtime error 593 ms 524288 KB Execution killed with signal 9
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Runtime error 778 ms 524288 KB Execution killed with signal 9
7 Runtime error 746 ms 524288 KB Execution killed with signal 9
8 Runtime error 756 ms 524288 KB Execution killed with signal 9
9 Execution timed out 3053 ms 2392 KB Time limit exceeded
10 Incorrect 1 ms 2392 KB Output isn't correct
11 Runtime error 1217 ms 524288 KB Execution killed with signal 9
12 Runtime error 1248 ms 524288 KB Execution killed with signal 9
13 Runtime error 1252 ms 524288 KB Execution killed with signal 9
14 Runtime error 1202 ms 524288 KB Execution killed with signal 9
15 Execution timed out 3045 ms 266216 KB Time limit exceeded
16 Runtime error 1796 ms 524288 KB Execution killed with signal 9
17 Execution timed out 3039 ms 2584 KB Time limit exceeded
18 Runtime error 1786 ms 524288 KB Execution killed with signal 9
19 Runtime error 1751 ms 524288 KB Execution killed with signal 9
20 Incorrect 5 ms 2572 KB Output isn't correct
21 Execution timed out 2037 ms 524288 KB Time limit exceeded
22 Execution timed out 3038 ms 2852 KB Time limit exceeded
23 Execution timed out 2036 ms 524288 KB Time limit exceeded
24 Execution timed out 3040 ms 2856 KB Time limit exceeded
25 Execution timed out 3055 ms 134516 KB Time limit exceeded
26 Execution timed out 3051 ms 2856 KB Time limit exceeded
27 Execution timed out 3032 ms 2916 KB Time limit exceeded
28 Execution timed out 2055 ms 524288 KB Time limit exceeded
29 Execution timed out 3036 ms 2852 KB Time limit exceeded
30 Incorrect 21 ms 3112 KB Output isn't correct
31 Runtime error 961 ms 524288 KB Execution killed with signal 9
32 Runtime error 1441 ms 524288 KB Execution killed with signal 9
# 결과 실행 시간 메모리 Grader output
1 Runtime error 366 ms 524288 KB Execution killed with signal 9
2 Execution timed out 3037 ms 2392 KB Time limit exceeded
3 Execution timed out 3010 ms 2392 KB Time limit exceeded
4 Runtime error 535 ms 524288 KB Execution killed with signal 9
5 Correct 1 ms 2392 KB Output is correct
6 Runtime error 747 ms 524288 KB Execution killed with signal 9
7 Runtime error 785 ms 524288 KB Execution killed with signal 9
8 Execution timed out 3023 ms 2392 KB Time limit exceeded
9 Runtime error 760 ms 524288 KB Execution killed with signal 9
10 Correct 1 ms 2392 KB Output is correct
11 Execution timed out 3083 ms 2392 KB Time limit exceeded
12 Runtime error 1201 ms 524288 KB Execution killed with signal 9
13 Runtime error 1228 ms 524288 KB Execution killed with signal 9
14 Runtime error 1213 ms 524288 KB Execution killed with signal 9
15 Execution timed out 3046 ms 266568 KB Time limit exceeded
16 Execution timed out 3043 ms 2588 KB Time limit exceeded
17 Execution timed out 3011 ms 2592 KB Time limit exceeded
18 Execution timed out 3021 ms 2588 KB Time limit exceeded
19 Execution timed out 3066 ms 2576 KB Time limit exceeded
20 Correct 5 ms 2568 KB Output is correct
21 Execution timed out 2084 ms 524288 KB Time limit exceeded
22 Execution timed out 3029 ms 2852 KB Time limit exceeded
23 Execution timed out 3022 ms 2856 KB Time limit exceeded
24 Execution timed out 2106 ms 524288 KB Time limit exceeded
25 Execution timed out 3033 ms 135292 KB Time limit exceeded
26 Execution timed out 2057 ms 524288 KB Time limit exceeded
27 Execution timed out 2041 ms 524288 KB Time limit exceeded
28 Execution timed out 2052 ms 524288 KB Time limit exceeded
29 Execution timed out 3092 ms 2860 KB Time limit exceeded
30 Correct 22 ms 3112 KB Output is correct
31 Runtime error 990 ms 524288 KB Execution killed with signal 9
32 Runtime error 1473 ms 524288 KB Execution killed with signal 9