이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, x, y;
int main() {
cin >> n >> x >> y;
ll squareLeft = x;
ll squareRight = x;
ll squareTop = y;
ll squareBottom = y;
string s;
while (squareLeft > 1)
{
squareLeft--;
cout << "examine " << squareLeft << " " << y << "\n";
fflush(stdout);
cin >> s;
if (s == "false")
{
squareLeft++;
break;
}
}
while (squareRight < n)
{
squareRight++;
cout << "examine " << squareRight << " " << y << "\n";
fflush(stdout);
cin >> s;
if (s == "false")
{
squareRight--;
break;
}
}
while (squareBottom > 1)
{
squareBottom--;
cout << "examine " << squareBottom << " " << y << "\n";
fflush(stdout);
cin >> s;
if (s == "false")
{
squareBottom++;
break;
}
}
while (squareTop < n)
{
squareTop++;
cout << "examine " << squareTop << " " << y << "\n";
fflush(stdout);
cin >> s;
if (s == "false")
{
squareTop--;
break;
}
}
ll centreX = (squareLeft + squareRight)/2;
ll centreY = (squareBottom + squareTop)/2;
ll sideLength = squareRight - squareLeft + 1;
ll rowAdj = 0;
ll colAdj = 0;
bool twoPlus, onePlus, oneMinus, twoMinus;
twoPlus = onePlus = oneMinus = twoMinus = false;
if (centreX + 4 * sideLength <= n)
{
cout << "examine " << centreX + 4 * sideLength << " " << centreY << "\n";
fflush(stdout);
cin >> s;
if (s == "true")
{
twoPlus = true;
}
}
if (centreX + 2 * sideLength <= n)
{
cout << "examine " << centreX + 2 * sideLength << " " << centreY << "\n";
fflush(stdout);
cin >> s;
if (s == "true")
{
onePlus = true;
}
}
if (centreX - 2 * sideLength >= 1)
{
cout << "examine " << centreX - 2 * sideLength << " " << centreY << "\n";
fflush(stdout);
cin >> s;
if (s == "true")
{
oneMinus = true;
}
}
if (centreX - 4 * sideLength >= 1)
{
cout << "examine " << centreX - 4 * sideLength << " " << centreY << "\n";
fflush(stdout);
cin >> s;
if (s == "true")
{
twoMinus = true;
}
}
if (twoPlus)
{
colAdj = 2;
}
else if (twoMinus)
{
colAdj = -2;
}
else if (onePlus and oneMinus)
{
colAdj = 0;
}
else if (onePlus)
{
colAdj = 1;
}
else
{
colAdj = -1;
}
twoPlus = onePlus = oneMinus = twoMinus = false;
if (centreY + 4 * sideLength <= n)
{
cout << "examine " << centreX << " " << centreY + 4 * sideLength << "\n";
fflush(stdout);
cin >> s;
if (s == "true")
{
twoPlus = true;
}
}
if (centreY + 2 * sideLength <= n)
{
cout << "examine " << centreX << " " << centreY + 2 * sideLength << "\n";
fflush(stdout);
cin >> s;
if (s == "true")
{
onePlus = true;
}
}
if (centreY - 2 * sideLength >= 1)
{
cout << "examine " << centreX << " " << centreY - 2 * sideLength << "\n";
fflush(stdout);
cin >> s;
if (s == "true")
{
oneMinus = true;
}
}
if (centreY - 4 * sideLength >= 1)
{
cout << "examine " << centreX << " " << centreY - 4 * sideLength << "\n";
fflush(stdout);
cin >> s;
if (s == "true")
{
twoMinus = true;
}
}
if (twoPlus)
{
rowAdj = 2;
}
else if (twoMinus)
{
rowAdj = -2;
}
else if (onePlus and oneMinus)
{
rowAdj = 0;
}
else if (onePlus)
{
rowAdj = 1;
}
else
{
rowAdj = -1;
}
centreY += rowAdj * sideLength;
centreX += colAdj * sideLength;
cout << "solution " << centreX << " " << centreY << "\n";
fflush(stdout);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |