Submission #201705

# Submission time Handle Problem Language Result Execution time Memory
201705 2020-02-11T19:36:03 Z stefdasca Snake (CEOI08_snake) C++14
15 / 100
6 ms 376 KB
#include "snakelib.h"
#include<bits/stdc++.h>
using namespace std;
int k;
char x, y;
void casework(int &st, int &dr, int mid1, int mid2)
{
    if(x == 's' && y == 'f')
    {
        st = (st + mid1 + k) / 2;
        dr = mid2 + k;
    }
    if(x == 'b' && y == 'b')
        st = mid2;
    if(x == 'f' && y == 'f')
        dr = mid1 + k;
    if(x == 'b' && y == 'f')
    {
        st = mid1;
        dr = mid2 + k;
    }
    if(x == 'b' && y == 's')
    {
        st = mid1;
        dr = (dr + mid2 + k) / 2;
    }
}
int main()
{
    k = get_speed();
    int st = 0;
    int dr = 12121;
    int qu = 13;
    while(qu)
    {
        int mid1 = st + (dr - st) / 3;
        int mid2 = dr - (dr - st) / 3;
        ask_snake(mid1, mid2, &x, &y);
        --qu;
        if(x == 's' && y == 's')
        {
            while(qu && x == 's' && y == 's')
            {
                mid1 = (st + mid1 - k) / 2;
                mid2 = (dr + mid2 + k) / 2;
                ask_snake(mid1, mid2, &x, &y);
                --qu;
            }
            casework(st, dr, mid1, mid2);
        }
        else
            casework(st, dr, mid1, mid2);
    }
    tell_length(dr - st + 1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 248 KB your estimate differs too much (1 units)
2 Incorrect 5 ms 376 KB your estimate differs too much (1678 units)
3 Incorrect 5 ms 248 KB your estimate differs too much (32 units)
4 Incorrect 5 ms 248 KB your estimate differs too much (12 units)
5 Incorrect 4 ms 248 KB your estimate differs too much (67 units)
6 Incorrect 5 ms 248 KB your estimate differs too much (1 units)
7 Incorrect 5 ms 248 KB your estimate differs too much (4 units)
8 Incorrect 5 ms 376 KB your estimate differs too much (4 units)
9 Correct 5 ms 376 KB Output is correct: estimate ok. 13 calls needed
10 Correct 5 ms 248 KB Output is correct: estimate ok. 13 calls needed
11 Incorrect 5 ms 248 KB your estimate differs too much (6 units)
12 Incorrect 5 ms 248 KB your estimate differs too much (2 units)
13 Correct 5 ms 248 KB Output is correct: estimate ok. 13 calls needed
14 Incorrect 5 ms 248 KB your estimate differs too much (840 units)
15 Incorrect 5 ms 248 KB your estimate differs too much (90 units)
16 Incorrect 5 ms 248 KB your estimate differs too much (626 units)
17 Incorrect 5 ms 376 KB your estimate differs too much (112 units)
18 Incorrect 5 ms 248 KB your estimate differs too much (782 units)
19 Incorrect 6 ms 248 KB your estimate differs too much (29 units)
20 Incorrect 5 ms 248 KB your estimate differs too much (87 units)