Submission #671086

#TimeUsernameProblemLanguageResultExecution timeMemory
671086AdamGSGap (APIO16_gap)C++17
0 / 100
23 ms1068 KiB
#include "gap.h"
#include<bits/stdc++.h>
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
const ll INF=1e18;
ll findGap(int t, int n) {
        vector<ll>A, B;
        ll mi=0, ma=INF;
        while(true) {
                ll *a, *b;
                MinMax(mi, ma, a, b);
                if(*a==-1) break;
                A.pb(*a);
                B.pb(*b);
                mi=(*a)+1;
                ma=(*b)-1;
        }
        reverse(all(B));
        for(auto i : B) A.pb(i);
        ll ans=0;
        rep(i, A.size()-1) ans=max(ans, A[i+1]-A[i]);
        return ans;
}

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:3:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
gap.cpp:24:9: note: in expansion of macro 'rep'
   24 |         rep(i, A.size()-1) ans=max(ans, A[i+1]-A[i]);
      |         ^~~
gap.cpp:14:23: warning: 'a' is used uninitialized in this function [-Wuninitialized]
   14 |                 MinMax(mi, ma, a, b);
      |                 ~~~~~~^~~~~~~~~~~~~~
gap.cpp:14:23: warning: 'b' is used uninitialized in this function [-Wuninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...