Submission #535448

#TimeUsernameProblemLanguageResultExecution timeMemory
535448daisyGap (APIO16_gap)C++17
0 / 100
47 ms1184 KiB
#include<iostream>
#include "gap.h"
#define l 1000000000000000000
using namespace std;
long long subt1(long long n)
{
    long long tf,ts,pf,ps,mr=0;

    MinMax(0,l,&tf,&ts);

    while(tf+1<ts && tf!=-1)
    {
        pf=tf;ps=ts;
        MinMax(pf+1,ps-1,&tf,&ts);

        if(tf-pf>mr) mr=tf-pf;
        if(ps-ts>mr) mr=ps-ts;
    }
    if(!ts==-1 && ts-tf>mr) mr=ts-tf;
    return mr;
}
long long findGap(int T, int N)
{
    return subt1(N);
	return 0;
}

Compilation message (stderr)

gap.cpp: In function 'long long int subt1(long long int)':
gap.cpp:19:11: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   19 |     if(!ts==-1 && ts-tf>mr) mr=ts-tf;
      |           ^~
gap.cpp:19:8: note: add parentheses around left hand side expression to silence this warning
   19 |     if(!ts==-1 && ts-tf>mr) mr=ts-tf;
      |        ^~~
      |        (  )
gap.cpp:19:11: warning: comparison of constant '-1' with boolean expression is always false [-Wbool-compare]
   19 |     if(!ts==-1 && ts-tf>mr) mr=ts-tf;
      |        ~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...