Submission #1057841

# Submission time Handle Problem Language Result Execution time Memory
1057841 2024-08-14T06:42:30 Z 12345678 Aliens (IOI07_aliens) C++17
10 / 100
1 ms 440 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int kx=32;

ll n, a, b, p[kx], mnx, mny, mxx, mxy, tmp, cx, cy, sz, tmnx, tmxx, tmny, tmxy;
map<pair<ll, ll>, int> mp;
string res;

int query(ll x, ll y)
{
    if (x<1||x>n||y<1||y>n) return 0;
    if (mp.find({x, y})!=mp.end()) return mp[{x, y}];
    cout<<"examine "<<x<<' '<<y<<endl;
    fflush(stdout);
    cin>>res;
    return mp[{x, y}]=(res[0]=='t');
}

int main()
{
    cin>>n>>a>>b;
    p[0]=1;
    for (int i=1; i<kx; i++) p[i]=p[i-1]*2;
    mnx=mxx=a, mny=mxy=b;
    for (int i=kx-1; i>=0; i--) if (query(mnx-p[i], b)) mnx=mnx-p[i];
    for (int i=kx-1; i>=0; i--) if (query(mxx+p[i], b)) mxx=mxx+p[i];
    for (int i=kx-1; i>=0; i--) if (query(a, mny-p[i])) mny=mny-p[i];
    for (int i=kx-1; i>=0; i--) if (query(a, mxy+p[i])) mxy=mxy+p[i];
    tmnx=tmxx=cx=(mnx+mxx)/2;
    tmny=tmxy=cy=(mny+mxy)/2;
    sz=mxx-mnx+1;
    for (int i=1; i<=2; i++) if (query(cx-i*sz, cy)) tmnx=min(tmnx, cx-i*sz);
    for (int i=1; i<=2; i++) if (query(cx+i*sz, cy)) tmxx=max(tmxx, cx+i*sz);
    for (int i=1; i<=2; i++) if (query(cx, cy-i*sz)) tmny=min(tmny, cy-i*sz);
    for (int i=1; i<=2; i++) if (query(cx, cy+i*sz)) tmxy=min(tmxy, cy+i*sz);
    cout<<"solution "<<(tmnx+tmxx)/2<<' '<<(tmny+tmxy)/2<<endl;
    fflush(stdout);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 440 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -