Submission #71816

# Submission time Handle Problem Language Result Execution time Memory
71816 2018-08-25T16:22:55 Z Give_Me_Vita(#2255, gs13105) The Ant Doing Hard Work (FXCUP3_ant) C++17
100 / 100
3 ms 440 KB
#include "ant.h"

int FindK()
{
    int f = 66666666;
    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 time Memory Grader output
1 Correct 2 ms 248 KB Correct
2 Correct 2 ms 356 KB Correct
3 Correct 3 ms 440 KB Correct
4 Correct 2 ms 440 KB Correct
5 Correct 2 ms 440 KB Correct