Submission #864681

# Submission time Handle Problem Language Result Execution time Memory
864681 2023-10-23T12:22:21 Z Trisanu_Das Mađioničar (COI22_madionicar) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
int qry(int x, int y){
  int x;
  cout << "? " << i + 1 << ' ' << j + 1 << endl;
  cin >> x;
  return x;
}
 
int main(){
  int n; cin >> n;
  int ans = 0, l;
  for(int t = 0; t < 2; t++){
    for(int i = 0, l = t; i < n; i++) while(i > 0 && i + l < n && qry(i - 1, i + l)) i--, l += 2;
    ans = max(ans, l);
  }
  cout << "? " << ans << endl;
}

Compilation message

Main.cpp: In function 'int qry(int, int)':
Main.cpp:5:7: error: declaration of 'int x' shadows a parameter
    5 |   int x;
      |       ^
Main.cpp:4:13: note: 'int x' previously declared here
    4 | int qry(int x, int y){
      |         ~~~~^
Main.cpp:6:19: error: 'i' was not declared in this scope
    6 |   cout << "? " << i + 1 << ' ' << j + 1 << endl;
      |                   ^
Main.cpp:6:35: error: 'j' was not declared in this scope
    6 |   cout << "? " << i + 1 << ' ' << j + 1 << endl;
      |                                   ^