제출 #835702

#제출 시각아이디문제언어결과실행 시간메모리
835702aykhnGap (APIO16_gap)C++14
42.65 / 100
48 ms2248 KiB
#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 = 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;
    }
 
 
}

컴파일 시 표준 에러 (stderr) 메시지

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 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...