Submission #1354830

#TimeUsernameProblemLanguageResultExecution timeMemory
1354830Francisco_MartinFind the Box (EGOI23_findthebox)C++20
100 / 100
0 ms352 KiB
//EGOI 2023 Find the Box
//https://qoj.ac/contest/1354/problem/7156

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;

pair<ll,ll> query(string s){
    cout << "? " << s << endl;
    ll x, y; cin >> x >> y; return {x,y};
}
pair<ll,ll> ans(ll x,ll y){
    cout << "! " << x << " " << y << endl;
    exit(0);
}

int main(){
    ll n, m; string s;
    cin >> n >> m;
    auto [x1,y1]=query(string(50,'>')+string(50,'v'));
    if(x1!=n-1) ans(x1+1,m-1);
    if(y1!=m-1) ans(0,y1+1);
    for(int i=0; i<50; i++){
        s+=string(50,'>'); s+="^>>v";
        s+=string(50,'<'); s+="^<v<v";
    }
    s+=string(50,'>'); auto [x2,y2]=query(s);
    if(y2==m-1) ans(x2+1,0);
    else ans(x2,y2+1);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...