Submission #294021

# Submission time Handle Problem Language Result Execution time Memory
294021 2020-09-08T14:28:54 Z AaronNaidu Aliens (IOI07_aliens) C++14
40 / 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 " << x << " " << squareBottom << "\n";
        fflush(stdout); 
        cin >> s;
        if (s == "false")
        {
            squareBottom++;
            break;
        }
    }
    while (squareTop < n)
    {
        squareTop++;
        cout << "examine " << x << " " << squareTop << "\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 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 256 KB too many queries
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Execution timed out 3103 ms 256 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 10 ms 256 KB too many queries
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3068 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 235 ms 256 KB too many queries
2 Halted 0 ms 0 KB -