Submission #945514

#TimeUsernameProblemLanguageResultExecution timeMemory
945514dugersurenSnake (CEOI08_snake)C++17
Compilation error
0 ms0 KiB
#include "snakelib.h" #include<bits/stdc++.h> using namespace std; int k,l,r,minLen,maxLen,mid1,mid2; char a1, a2; int ask_snake(){ k=get_speed(); minLen=1;maxLen=12122; l=0;r=12122; for(int i=1;i<=13;++i){ mid1=l+(r-l)/3; mid2=r–(r-l)/3; ask_snake(mid1,mid2,&a1,&a2); if(a1=='f'){ if(a2='f') maxLen=mid2-l,r=mid2+k-1; if(a2='s')minLen=mid2-mid1+2,maxLen=mid2-l,r=mid2+k; if(a2='b')minLen=mid2-mid1+3,r+=k; } if(a1='s'){ if(a2='s'){ return minLen=r-l+1; } l=mid1; if(a2='f')maxLen=mid2-l,r=mid2+k-1; if(a2='b')maxLen=r-mid1+1,r=mid2+k; } if(a1='b'){ l=mid1+1; if(a2='f')maxLen=mid2-mid1-1,r=mid2+k-1; if(a2='s')maxLen=mid2-mid1,r=mid2+k,r=mid2+k; if(a2='b')minLen=r-mid1+1,r+=k; } } int guess=(maxLen+minLen)/2; tell_length(guess); }

Compilation message (stderr)

snake.cpp:12:8: error: extended character – is not valid in an identifier
   12 |   mid2=r–(r-l)/3;
      |        ^
snake.cpp: In function 'int ask_snake()':
snake.cpp:12:8: error: 'r\U00002013' was not declared in this scope
   12 |   mid2=r–(r-l)/3;
      |        ^~
snake.cpp:15:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   15 |          if(a2='f') maxLen=mid2-l,r=mid2+k-1;
      |             ~~^~~~
snake.cpp:16:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   16 |          if(a2='s')minLen=mid2-mid1+2,maxLen=mid2-l,r=mid2+k;
      |             ~~^~~~
snake.cpp:17:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   17 |          if(a2='b')minLen=mid2-mid1+3,r+=k;
      |             ~~^~~~
snake.cpp:19:8: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   19 |   if(a1='s'){
      |      ~~^~~~
snake.cpp:20:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   20 |    if(a2='s'){
      |       ~~^~~~
snake.cpp:24:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   24 |    if(a2='f')maxLen=mid2-l,r=mid2+k-1;
      |       ~~^~~~
snake.cpp:25:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   25 |    if(a2='b')maxLen=r-mid1+1,r=mid2+k;
      |       ~~^~~~
snake.cpp:28:8: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   28 |   if(a1='b'){
      |      ~~^~~~
snake.cpp:30:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   30 |    if(a2='f')maxLen=mid2-mid1-1,r=mid2+k-1;
      |       ~~^~~~
snake.cpp:31:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   31 |          if(a2='s')maxLen=mid2-mid1,r=mid2+k,r=mid2+k;
      |             ~~^~~~
snake.cpp:32:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   32 |          if(a2='b')minLen=r-mid1+1,r+=k;
      |             ~~^~~~
snake.cpp:36:16: warning: control reaches end of non-void function [-Wreturn-type]
   36 |     tell_length(guess);
      |     ~~~~~~~~~~~^~~~~~~