Submission #1353156

#TimeUsernameProblemLanguageResultExecution timeMemory
1353156branches1029Find the Box (EGOI23_findthebox)C++20
0 / 100
0 ms440 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n, m;
int x, y;
string s;

int main(){

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> m;

    s="";
    for( int i=0 ; i<n-1 ; i++ ) s+='v';
    for( int j=0 ; j<m-1 ; j++ ) s+='>';
    cout << "? " << s << endl;
    cin >> x >> y;
    if( x!=n-1 ){
        cout << "! " << x+1 << ' ' << 0 << '\n';
        return 0;
    }
    else if( y!=m-1 ){
        cout << "! " << n-1 << ' ' << y+1 << '\n';
        return 0;
    }

    for( int j=1 ; j<m ; j++ ){
        s+='>';
        for( int i=0 ; i<n ; i++ ) s+='v';
        s+='<';
        s+='v';
        s+='>';
        for( int i=0 ; i<n ; i++ ) s+='^';
    }
    for( int i=0 ; i<n ; i++ ) s+='v';
    cout << "? " << s << endl;

    cin >> x >> y;
    cout << "! " << x+1 << ' ' << y << '\n';

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...