# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
201709 | stefdasca | Snake (CEOI08_snake) | C++14 | 5 ms | 380 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 == 's')
{
st = (st + mid1) / 2;
dr = (dr + mid2) / 2 + k;
}
if(x == 's' && y == 'f')
{
st = (st + mid1) / 2;
dr = mid2 + k;
}
if(x == 'b' && y == 'b')
st = mid1;
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) / 2 + 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;
casework(st, dr, mid1, mid2);
}
tell_length(dr - st + 1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |