Submission #713174

#TimeUsernameProblemLanguageResultExecution timeMemory
713174Aaryan1378Colors (BOI20_colors)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int solve(long long int left, long long int right) { if(left >= right) { cout << "=" << " " << left << endl; return; } long long int mid = (left + right + 1) / 2; cout << "?" << " " << mid << endl; long long int ans; cin >> ans; if(ans == 1) { solve(left, mid); } else { solve(mid + 1, right) } } int main() { //your code goes here long long int n; cin >> n; solve(1, n); return 0; }

Compilation message (stderr)

Colors.cpp: In function 'int solve(long long int, long long int)':
Colors.cpp:8:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
    8 |     return;
      |     ^~~~~~
Colors.cpp:17:26: error: expected ';' before '}' token
   17 |     solve(mid + 1, right)
      |                          ^
      |                          ;
   18 |   }
      |   ~                       
Colors.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^