Submission #71814

#TimeUsernameProblemLanguageResultExecution timeMemory
71814Give_Me_Vita (#119)The Ant Doing Hard Work (FXCUP3_ant)C++17
90 / 100
3 ms468 KiB
#include "ant.h"

int FindK()
{
    int f = 75000000;
    int t = DeliverCount(f);

    int s, g;
    if(t == 0)
    {
        s = f + 1;
        g = 99999999;
    }
    else if(t == 1)
    {
        s = f / 2 + 1;
        g = f;
    }
    else
    {
        s = 1;
        g = f / 2;
    }

    while(s < g)
    {
        int x = (s + g) / 2;

        int t = DeliverCount(x);

        if(t > 1)
            g = x - 1;
        else if(t == 1)
            g = x;
        else
            s = x + 1;
    }
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...