Submission #770611

#TimeUsernameProblemLanguageResultExecution timeMemory
770611EnchomGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <iostream>
#include <stdio.h>
#include "gap.h"
using namespace std;
typedef long long llong;

llong solveSmall(int N)
{
    llong minVal, maxVal;
    llong L = 0, R = 1000000000000000000LL;
    int pL = 0, pR = N - 1;
    vector<llong> nums(N);

    while(pL <= pR)
    {
        MinMax(L, R, &minVal, &maxVal);

        nums[pL] = minVal;
        nums[pR] = maxVal;
        pL++;
        pR--;

        L = minVal + 1;
        R = maxVal - 1;
    }

    llong ans = 0;
    for (int i = 1; i < nums.size(); i++)
    {
        ans = max(ans, nums[i] - nums[i - 1]);
    }

    return ans;
}

llong solveBig(int N)
{
    return 0LL;
}

llong findGap(int T, int N)
{
    if (T == 1)
        return solveSmall(N);
    else
        return solveBig(N);
}

/*
int main()
{

}
*/

Compilation message (stderr)

gap.cpp: In function 'llong solveSmall(int)':
gap.cpp:12:5: error: 'vector' was not declared in this scope
   12 |     vector<llong> nums(N);
      |     ^~~~~~
gap.cpp:4:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    3 | #include "gap.h"
  +++ |+#include <vector>
    4 | using namespace std;
gap.cpp:12:17: error: expected primary-expression before '>' token
   12 |     vector<llong> nums(N);
      |                 ^
gap.cpp:12:19: error: 'nums' was not declared in this scope
   12 |     vector<llong> nums(N);
      |                   ^~~~