#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 == 'b')
dr = mid2 + k;
if(x == 'b' && y == 'b')
dr = mid1 + k;
if(x == 'f' && y == 'f')
{
st = mid1 - k;
dr = mid2 + k;
}
if(x == 'f' && y == 'b')
{
st = mid1 - k;
dr = mid2 + k;
}
if(x == 'f' && y == 's')
st = mid1 - k;
}
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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
248 KB |
your estimate differs too much (2 units) |
2 |
Incorrect |
5 ms |
252 KB |
your estimate differs too much (6290 units) |
3 |
Incorrect |
6 ms |
376 KB |
your estimate differs too much (974 units) |
4 |
Incorrect |
5 ms |
300 KB |
your estimate differs too much (11037 units) |
5 |
Incorrect |
5 ms |
376 KB |
your estimate differs too much (579 units) |
6 |
Incorrect |
5 ms |
248 KB |
your estimate differs too much (12112 units) |
7 |
Incorrect |
5 ms |
248 KB |
your estimate differs too much (12121 units) |
8 |
Incorrect |
6 ms |
248 KB |
your estimate differs too much (12120 units) |
9 |
Incorrect |
5 ms |
376 KB |
your estimate differs too much (12119 units) |
10 |
Incorrect |
5 ms |
376 KB |
your estimate differs too much (12118 units) |
11 |
Incorrect |
5 ms |
248 KB |
your estimate differs too much (12117 units) |
12 |
Incorrect |
5 ms |
376 KB |
your estimate differs too much (12121 units) |
13 |
Incorrect |
5 ms |
376 KB |
your estimate differs too much (12116 units) |
14 |
Incorrect |
5 ms |
376 KB |
your estimate differs too much (8081 units) |
15 |
Incorrect |
5 ms |
300 KB |
your estimate differs too much (8080 units) |
16 |
Incorrect |
6 ms |
252 KB |
your estimate differs too much (2825 units) |
17 |
Incorrect |
5 ms |
248 KB |
your estimate differs too much (10535 units) |
18 |
Incorrect |
5 ms |
248 KB |
your estimate differs too much (4726 units) |
19 |
Incorrect |
5 ms |
376 KB |
your estimate differs too much (3096 units) |
20 |
Incorrect |
6 ms |
248 KB |
your estimate differs too much (686 units) |