Submission #1015135

#TimeUsernameProblemLanguageResultExecution timeMemory
1015135vjudge1Gap (APIO16_gap)C++17
30 / 100
49 ms7020 KiB
#include <bits/stdc++.h>
// #include "grader.cpp"
#include "gap.h"

using namespace std;

typedef long long ll;

ll findGap(int T, int N){
    if (T == 1){
        set<ll> st;
        ll mn = 0, mx = 1e18;
        while (N > 0){
            N -= 2;

            MinMax(mn, mx, &mn, &mx);

            st.insert(mn);
            st.insert(mx);
            
            mn++;
            mx--;
        }

        vector<ll> vec;
        for (ll x : st)
            vec.push_back(x);

        ll res = 0;
        for (int i = 1; i < vec.size(); i ++)
            res = max(res, vec[i] - vec[i - 1]);
        return res;
    }
    return 0;
}

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:30:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for (int i = 1; i < vec.size(); i ++)
      |                         ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...