Masala #TCDOZ366AP
  
Toxirov molodes
https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/description/
use this template you motherfucker
#include <stdio.h>
#include <limits.h>
// 0 <= x < n
// this function returns value of hidden arr[x]
// use it <=20 times to get ACCEPTED (if more you will get TL or WA)
int ask(int x) {
int ans;
printf("? %d\n", x);
fflush(stdout);
scanf("%d", &ans);
return ans;
}
int main() {
int n;
scanf("%d", &n);
int min_val = INT_MAX;
// put your actual shitcode here
printf("! %d\n", min_val);
fflush(stdout);
return 0;
}
Kiruvchi ma'lumotlar:
Chiquvchi ma'lumotlar:
Misollar
# | input.txt | output.txt |
---|
Izoh:
In first test \(n=3\) and hidden array is \([19, 7, 12]\) (sorted + shifted by 1).
You will pass first test if you print 7.
Yechimini yuborish
Bu amalni bajarish uchun tizimga kiring,
agar profilingiz bo'lmasa istalgan payt ro'yxatdan o'tishingiz mumkin