답안 #829011

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829011 2023-08-18T01:26:41 Z vjudge1 Colors (BOI20_colors) C++17
0 / 100
1 ms 312 KB
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define fi first
#define se second

ll n, l, r, mid, x, c, memo;
bool b;

int main() {
	fastio;
	cin >> n;
	l = 1;
	r = n;
	c = 1e9;
	for (int i = 1; i <= 10; i++) {
		mid = (l+r)/2;
		cout << "? " << 1 << endl;
		cin >> b;
		cout << "? " << mid << endl;
		cin >> b;
		if (!b) {
			l = mid + 1;
		} else {
			r = mid - 1;
			c = min(c, mid);
		}
	}
	cout << c << endl;
}
 
/*░░░░░░
        .,%%%%%,.          ..,,,,..
      .%%%;%;%;%;%,   .,%%%%%%%%%%%%%%,.     .,,,,.
      %%%;a@@@@@a;;,%%%%%%%%%%%%%%%%%%%%%%,;%%;%;%;%%,
      %%%;@@@@@@a;,%%%%%%%%%%%%%%%%%%%%%%%%%;a@@@@a;%%%
      `%%%;@@@a;,%%%%%%%%%%%%%%%%%%%%%%%%%%%%;a@@@@;%%%
        `%%%;;,%%%%%%%%%%%%%% .%%%,%% .%%%%%%%;a@@;%%%'
           ```%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%;%%%%'
             %%%%%%%%%%%%%%%%%%%'   #`%%%%%%%%%%'
             %%%%%%%%%%%%%%%%%%%,.  .,%%%%%%%%%%
             %%%%%%%%%%%%%%%;a@@@@a;a@@@a;%%%%%%
             `%%%%%%%%%%%;a@@@a@@@@a;a@@a@a;%%%'
              `%%%%%%%%%;@@@a@@@a@@@;a@a@a@;%%'    ..,,.
         ,sSSSSSs`%%%%%%%;@@@@@@@@@;a@@@@@;%'  .,%%%,;;;;,
       .S@S';;;,SSs %%%%%%%%%%%%%%%%%%%%%%' .,%%%%%%,;;;;;;,
       S@@SSss';;,sSs,s@SSSS@,sSSSSSSSSs,.%%%%%%%%%%%,;;;;;;,
       `S@@SSSSSSs;,Ss@@SSSS@@sSs';;;;,S@s,%%%%%%%%%%%,;;;;;;
       .S@@SSSSSSSSSSs@@SSSS@@sSSSSSs';,@@S,%%%%%%%%%%%%,;;;'
       S@@SSSSSSSSSSS'`@SSSS@s`SSSSSSSSs@S',%%%%%%%%%%%%%%'
      %`S@SSSSSSSSS'.SSSssssSSS`SSSSSSS@S'%%,%%%%%%%%%%'
    .%%%%,""""""%%.sSSSSS^SSSSSs%`SSSSSS'%%%%,%%%%%'
  .%%%%%%%%%%%%.sSSSSSSS'.sSSSSS,%%"""",%%%%%%,%'
 .%%%%%%%%%%%.sSSSSSSSS'.SSSSSSSS,%%%%%%%%%%%%%.
.%.%.%.%.%.%.SSSSSSSSS',SSSS^SSSSS,%,%%%%%%%%%%%
%;;;;;;;;;%,SSSSS^SSSS,,SSS',SSSS'%%%%%%%%%%%%%%,
;;;;;;;;;;;,SSSS'%`SS';%`S'%,SS'%%%%%,%%%%%%%%%%%
 `;;;;;;;;'%`SS'%%,S'%%%%,%,S'%%%%%%%%%%%%%%%%%%%
          %%%`S,%%%%%%%%%%%%%%%%%%%%,%%%%%%%%%%%'
          ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
         .%`%%%%%%%%%%%%%%%%%%%%%%,%%%%%%%%%%%'%
         %%%`%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'%%%.
        ;%%%%%`%%%%%%%%%%%%%%%%,%%%%%%%%%'%%%%%%%.
        %%%%%%%;%:%:%:%:%%%'`%%:%:%:%:%:%%%%%%%%%%,
        %%%%%%%%%%%%%%%%%%%. `%%%%%%%%%%%%%%%%%%%%%%,
        %%%%%%%%%%%%%%%%%%%%   `%%%%%%%%%%%%%%%%%%%%%%,
        %%%%%%%%%%%%%%%%%%%%.    `%%%%%%%%%%%%%%%%%%%%%%,
        %%%%%%%%%%%%%%%%%%%%%      `%%%%%%%%%%,%%%,%%%,%%%,
        %%%%%%%%,%%%,%%%,%%,%.       `%%%%%,;;;;;;;;;;;;;,%,
        `%%%%,;;;;;;;;;;;;;;,%        `%%,;;;;;;;;;;;;;;;;;;
         `%,;;;;;;;;;;;;;;;;;;         `;;;;;;;;;;;;;;;;;;;'
          `%;;;;;;;;;;;;;;;;;'           `;;;;;;;;;;;;;;;;'
            `;;;;;;;;;;;;;;'                '''''''''''''
                ''''''''''
          				.============.
                       |    Beary    |
                       `------------'  
*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 312 KB Token parameter [name=cmd] equals to "5", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 312 KB Token parameter [name=cmd] equals to "5", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 312 KB Token parameter [name=cmd] equals to "5", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 312 KB Token parameter [name=cmd] equals to "5", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 312 KB Token parameter [name=cmd] equals to "5", doesn't correspond to pattern "[?=]"
2 Halted 0 ms 0 KB -