Submission #201716

# Submission time Handle Problem Language Result Execution time Memory
201716 2020-02-11T20:07:00 Z stefdasca Snake (CEOI08_snake) C++14
0 / 100
6 ms 376 KB
#include "snakelib.h"
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a1, a2;
    int k = get_speed();
    int stL = -1;
    int stR = 12122;
    int drL = -1;
    int drR = 12122;
    int qu = 13;
    for(; qu; --qu)
    {
        drL += k;
        drR += k;
        int midL = (stL + drL - 1) / 2;
        int midR = (stR + drL) / 2;
        if(stL == drL && stR == drR)
        {
            midL = stL + (stR - stL) / 3;
            midR = stR + (drR - drL) * 2 / 3;
        }
        ask_snake(midL, midR, &a1, &a2);
        if(a1 == 's')
        {
            stR = midL + 1;
            drL = max(drL, midL);
        }
        else
            if(a1 == 'f')
            {
                stR = midL;
                drR = min(drR, midL);
            }
            else
                if(a1 == 'b')
                {
                    stL = midL + 1;
                    drL = max(drL, midL + 1);
                }
        if(a2 == 's')
        {
            drL = midR;
            stR = min(stR, drL + 1);
        }
        else
            if(a2 == 'f')
            {
                drR = midR;
                stR = min(stR, drR);
            }
            else
                if(a2 == 'f')
                {
                    drL = midR + 1;
                    stR = max(stR, drL);
                }
    }
    int max_ans = drR - stL + 1;
    int min_ans = drL - stR + 1;
    int guess = (max_ans + min_ans)/ 2;
    tell_length(guess);
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB call of ask_snake with invalid units (4040, 20204)
2 Incorrect 5 ms 376 KB your estimate differs too much (2367 units)
3 Incorrect 5 ms 376 KB your estimate differs too much (942 units)
4 Incorrect 5 ms 248 KB your estimate differs too much (2406 units)
5 Incorrect 5 ms 248 KB your estimate differs too much (536 units)
6 Incorrect 5 ms 376 KB call of ask_snake with invalid units (4040, 20204)
7 Incorrect 6 ms 376 KB call of ask_snake with invalid units (-1, 6061)
8 Incorrect 5 ms 376 KB your estimate differs too much (3038 units)
9 Incorrect 5 ms 248 KB your estimate differs too much (3043 units)
10 Incorrect 5 ms 376 KB your estimate differs too much (3050 units)
11 Incorrect 5 ms 248 KB your estimate differs too much (3063 units)
12 Incorrect 5 ms 248 KB call of ask_snake with invalid units (4040, 20204)
13 Incorrect 5 ms 248 KB your estimate differs too much (3069 units)
14 Incorrect 5 ms 376 KB call of ask_snake with invalid units (-1, 6061)
15 Incorrect 5 ms 248 KB your estimate differs too much (64 units)
16 Incorrect 5 ms 248 KB call of ask_snake with invalid units (4040, 20204)
17 Incorrect 5 ms 248 KB call of ask_snake with invalid units (-1, 6061)
18 Incorrect 5 ms 248 KB your estimate differs too much (1783 units)
19 Incorrect 5 ms 376 KB your estimate differs too much (200 units)
20 Incorrect 5 ms 376 KB your estimate differs too much (665 units)