Submission #294008

# Submission time Handle Problem Language Result Execution time Memory
294008 2020-09-08T14:24:20 Z AaronNaidu Aliens (IOI07_aliens) C++14
0 / 100
1000 ms 256 KB
#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
1 Incorrect 0 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 2 ms 256 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 2 ms 256 KB Incorrect
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 256 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3062 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3072 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 260 ms 256 KB too many queries
2 Halted 0 ms 0 KB -