답안 #1000003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000003 2024-06-16T12:45:14 Z Newtonabc Aliens (IOI07_aliens) C++14
0 / 100
2 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b,k=0,prev;
	cin>>n >>a >>b;
	int tmpa=a,tmpb=b,da=a,db=b;
	while(true){
		string s;
		if(tmpa+(1<<k)>n){
			if(k==0) break;
			k=0,tmpa=prev;
			continue;
		}
		cout<<"examine " <<tmpa+(1<<k) <<" " <<b <<" " <<k <<endl;
		cin>>s;
		if(s=="true") k++,prev=tmpa+(1<<k);
		else{
			if(k==0) break;
			k=0,tmpa=prev;
		}
	}
	while(true){
		string s;
		if(tmpb+(1<<k)>n){
			if(k==0) break;
			k=0,tmpb=prev;
			continue;
		}
		cout<<"examine " <<a <<" " <<tmpb+(1<<k) <<endl;
		cin>>s;
		if(s=="true") k++,prev=tmpb+(1<<k);
		else{
			if(k==0) break;
			k=0,tmpa=prev;
		}
	}
	while(true){
		string s;
		if(da-(1<<k)<0){
			if(k==0) break;
			k=0,da=prev;
			continue;
		}
		cout<<"examine " <<da-(1<<k) <<" " <<b <<endl;
		cin>>s;
		if(s=="true") k++,prev=da-(1<<k);
		else{
			if(k==0) break;
			k=0,da=prev;
		}
	}
	while(true){
		string s;
		if(db-(1<<k)<0){
			if(k==0) break;
			k=0,db=prev;
			continue;
		}
		cout<<"examine " <<a <<" " <<db-(1<<k) <<endl;
		cin>>s;
		if(s=="true") k++,prev=db-(1<<k);
		else{
			if(k==0) break;
			k=0,db=prev;
		}
	}
	cout<<"solution " <<(da+tmpa)/2 <<" " <<(db+tmpb)/2;
}

Compilation message

aliens.cpp: In function 'int main()':
aliens.cpp:67:45: warning: 'db' may be used uninitialized in this function [-Wmaybe-uninitialized]
   67 |  cout<<"solution " <<(da+tmpa)/2 <<" " <<(db+tmpb)/2;
      |                                          ~~~^~~~~~
aliens.cpp:67:25: warning: 'da' may be used uninitialized in this function [-Wmaybe-uninitialized]
   67 |  cout<<"solution " <<(da+tmpa)/2 <<" " <<(db+tmpb)/2;
      |                      ~~~^~~~~~
aliens.cpp:9:10: warning: 'tmpa' may be used uninitialized in this function [-Wmaybe-uninitialized]
    9 |   if(tmpa+(1<<k)>n){
      |      ~~~~^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -