Submission #713124

# Submission time Handle Problem Language Result Execution time Memory
713124 2023-03-21T08:17:31 Z Aaryan1378 Colors (BOI20_colors) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

int solve(long long int left, long long int right) {
  if(left >= right) {
    cout << "=" << " " << left << endl;
  }
  long long int mid = (left + right + 1) / 2;
  cout << "?" << " " << mid << endl;
  long long int ans;
  cin >> ans;
  if(num == 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

Colors.cpp: In function 'int solve(long long int, long long int)':
Colors.cpp:13:6: error: 'num' was not declared in this scope; did you mean 'enum'?
   13 |   if(num == 1) {
      |      ^~~
      |      enum
Colors.cpp:14:21: error: expected ';' before '}' token
   14 |     solve(left, mid)
      |                     ^
      |                     ;
   15 |   } else {
      |   ~                  
Colors.cpp:16:26: error: expected ';' before '}' token
   16 |     solve(mid + 1, right)
      |                          ^
      |                          ;
   17 |   }
      |   ~                       
Colors.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^