Submission #864254

# Submission time Handle Problem Language Result Execution time Memory
864254 2023-10-22T09:30:09 Z noobcodur Mađioničar (COI22_madionicar) C++14
0 / 100
1 ms 344 KB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define forn(i,j) for(ll i = 0; i < j; i++)
#define forrange(i,j,k) for(int i = j; i < k; ++i)
#define rof(i,j) rof(int i = j; i >= 0; --i)
#define pii pair<int,int>
#define vll vector<ll>
#define vi vector<int>
#define vvll vector<vll>
#define vvi vector<vi>
#define vb vector<bool>
#define pb push_back
#define p push
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define debug(x) cerr << #x << " is " << x << endl;

#define MOD 1000000007

int t;

void check(int l, int r){
	t = 0;
	printf("? %d\n", l, r);
    fflush(stdout);
    scanf("%d\n", t);
}

bool check2(int l, int r){
	check(l,r);

	if(t == 1){
		return true;
	}

	return false;
}

int main(){
	int n;
	cin >> n;

	int max = 0;

	forrange(i,1,n+1){
		if(i + max + 1 < n + 1 && i - max - 1 > 0){
			if(check2(i - max - 1,i + max + 1)){
				max++;
			}
		}
	}

	if(max == 0){
		cout << 1 << endl;
	}

	else{
		cout << max << endl;
	}
}

Compilation message

Main.cpp: In function 'void check(int, int)':
Main.cpp:31:9: warning: too many arguments for format [-Wformat-extra-args]
   31 |  printf("? %d\n", l, r);
      |         ^~~~~~~~
Main.cpp:33:13: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'int' [-Wformat=]
   33 |     scanf("%d\n", t);
      |            ~^     ~
      |             |     |
      |             int*  int
Main.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |     scanf("%d\n", t);
      |     ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -