Submission #1353633

#TimeUsernameProblemLanguageResultExecution timeMemory
1353633sallyFind the Box (EGOI23_findthebox)C++20
20 / 100
0 ms412 KiB
#include<iostream>
using namespace std;
int H, W;
typedef pair<int,int> pii;
pii move(int right, int down) {
    if(right + down == 0) return {-1,-1};
    cout<<"? ";
    for(int i=0; i<right; i++) cout<<'>';
    for(int i=0; i<down; i++) cout<<'v';
    cout<<endl;
    int x, y;
    cin>>x>>y;
    return {x,y};
}
bool expected(int right, int down, int x, int y) {
    if(y == right && x == down) return true;
    return false;
}
void found(int right, int down, int x, int y) {
    cout<<"! ";
    if(down == x) {cout<<0<<' '<<y+1<<endl; return;}
    else {
        cout<<x+1<<' '<<y<<endl; return;
    }
}
int main() {
    cin>>H>>W;
    for(int right = 0; right<W; right++) {
        pii p = move(right, H-1);
        if(p.first == -1 || p.second == -1) continue;
        if(expected(right, H-1, p.first, p.second)) continue;
        else {found(right, H-1, p.first, p.second); break;}
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...