답안 #890316

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
890316 2023-12-21T03:05:39 Z MuhammadSaram Aliens (IOI07_aliens) C++17
10 / 100
1 ms 436 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n,x,y;
	cin>>n>>x>>y;
	int m,cor,cor1;
	for (int i=1;i<min(101,n-x+1);i++)
	{
		cout<<"examine "<<x+i<<' '<<y<<endl;
		string s;
		cin>>s;
		if (s=="false")
		{
			m=i;
			break;
		}
		if (i==n-x)
			m=i+1;
	}
	for (int i=1;i<min(101,x);i++)
	{
		cout<<"examine "<<x-i<<' '<<y<<endl;
		string s;
		cin>>s;
		if (s=="false")
		{
			cor=i;
			m+=i-1;
			break;
		}
		if (i==x-1)
		{
			m+=i;
			cor=x;
		}
	}
	for (int i=1;i<min(101,y);i++)
	{
		cout<<"examine "<<x<<' '<<y-i<<endl;
		string s;
		cin>>s;
		if (s=="false")
		{
			cor1=i;
			break;
		}
		if (i==y-1)
			cor1=y;
	}
	x+=(m+1)/2-cor;
	y+=(m+1)/2-cor1;
	for (int i=1;i<=5;i++)
		for (int j=1;j<=5;j++)
		{
			if (i%2!=j%2)
				continue;
			bool b=true;
			for (int k=1;k<=5 and b;k++)
				if (i%2==k%2 and k!=j)
				{
					int y1=y+(k-j)*m;
					if (y1<1 or y1>n)
						b=false;
					else
					{
						cout<<"examine "<<x<<' '<<y1<<endl;
						string s;
						cin>>s;
						if (s=="false")
							b=false;
					}
				}
			for (int k=1;k<=5 and b;k++)
				if (j%2==k%2 and k!=i)
				{
					int x1=x+(k-i)*m;
					if (x1<1 or x1>n)
						b=false;
					else
					{
						cout<<"examine "<<x1<<' '<<y<<endl;
						string s;
						cin>>s;
						if (s=="false")
							b=false;
					}
				}
			if (b)
			{
				cout<<"solution "<<x+(3-i)*m<<' '<<y+(3-j)*m<<endl;
				return 0;
			}
		}
}

Compilation message

aliens.cpp: In function 'int main()':
aliens.cpp:54:12: warning: 'cor1' may be used uninitialized in this function [-Wmaybe-uninitialized]
   54 |  y+=(m+1)/2-cor1;
      |     ~~~~~~~^~~~~
aliens.cpp:53:12: warning: 'cor' may be used uninitialized in this function [-Wmaybe-uninitialized]
   53 |  x+=(m+1)/2-cor;
      |     ~~~~~~~^~~~
aliens.cpp:31:5: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |    m+=i-1;
      |    ~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Runtime error 1 ms 436 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - token expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB too many queries
2 Halted 0 ms 0 KB -