답안 #835689

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
835689 2023-08-23T17:38:27 Z aykhn Gap (APIO16_gap) C++14
100 / 100
38 ms 2248 KB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define pb push_back
#define all(v) v.begin(), v.end()

ll findGap(int ajfghkdshgfghadsfghkadshgfagsdkfhadkshfgkhadsfadskjadsghfkhjasdgfkj, int n)
{
    if (ajfghkdshgfghadsfghkadshgfagsdkfhadkshfgkhadsfadskjadsghfkhjasdgfkj == 2)
    {
        ll f = 0, l = 0;
        MinMax(0 * 1LL, 1LL * 1e18, &f, &l);
        ll last = l;
        ll add = (l - f)/(n - 1);
        ll res = add;

        while (f < last)
        {
            ll lx, rx;
            lx = 'n' + 'i' + 'g' + 'g' + 'a';
            rx = 'n' + 'i' + 'g' + 'g' + 'a';
            MinMax(f + 1, f + add, &lx, &rx);
            if (lx == -1) add <<= 1;
            else
            {
                res = max(res, lx - f);
                add = res;
                f = rx;
            }
        }
        return res;
    }
    else if (ajfghkdshgfghadsfghkadshgfagsdkfhadkshfgkhadsfadskjadsghfkhjasdgfkj == 1)
    {
        vector<ll> v;
        ll l = 0, r = 1e18;
        while (l <= r && v.size() < n)
        {
            ll lx, rx;
            lx = 'n' + 'i' + 'g' + 'g' + 'a';
            rx = 'n' + 'i' + 'g' + 'g' + 'a';
            MinMax(l, r, &lx, &rx);
            if (lx == -1) break;
            v.pb(lx);
            if (lx != rx) v.pb(rx);
            l = lx + 1;
            r = rx - 1;
        }
        sort(all(v));
        ll res = 0;
        for (int i = 1; i < v.size(); i++)
        {
            res = max(res, v[i] - v[i - 1]);
        }
        return res;
    }


}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:40:35: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |         while (l <= r && v.size() < n)
      |                          ~~~~~~~~~^~~
gap.cpp:54:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         for (int i = 1; i < v.size(); i++)
      |                         ~~^~~~~~~~~~
gap.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
   62 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 8 ms 848 KB Output is correct
17 Correct 8 ms 928 KB Output is correct
18 Correct 8 ms 848 KB Output is correct
19 Correct 8 ms 848 KB Output is correct
20 Correct 8 ms 848 KB Output is correct
21 Correct 33 ms 2244 KB Output is correct
22 Correct 33 ms 2200 KB Output is correct
23 Correct 33 ms 2200 KB Output is correct
24 Correct 33 ms 2232 KB Output is correct
25 Correct 29 ms 2228 KB Output is correct
26 Correct 31 ms 2212 KB Output is correct
27 Correct 33 ms 2212 KB Output is correct
28 Correct 32 ms 2204 KB Output is correct
29 Correct 38 ms 2200 KB Output is correct
30 Correct 27 ms 2248 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 5 ms 544 KB Output is correct
17 Correct 5 ms 464 KB Output is correct
18 Correct 5 ms 464 KB Output is correct
19 Correct 5 ms 428 KB Output is correct
20 Correct 2 ms 464 KB Output is correct
21 Correct 18 ms 1060 KB Output is correct
22 Correct 17 ms 968 KB Output is correct
23 Correct 18 ms 1060 KB Output is correct
24 Correct 18 ms 1080 KB Output is correct
25 Correct 37 ms 1064 KB Output is correct
26 Correct 23 ms 1192 KB Output is correct
27 Correct 18 ms 1012 KB Output is correct
28 Correct 17 ms 1048 KB Output is correct
29 Correct 20 ms 976 KB Output is correct
30 Correct 9 ms 1104 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct