#include <bits/stdc++.h>
using namespace std;
#include "mountain.h"/*
vector<vector<int>> high; vector<pair<int,int>> ans;
int Measure(int RM,int CM){ return high[RM-1][CM-1]; }
void Pinpoint(int RP,int CP){ ans.emplace_back(RP,CP); }
void Rescue(int R,int C,int MR,int MC,int X);
int main(){
int q; cin >> q; while(q--){
int R,C,MR,MC,X; cin >> R >> C >> MR >> MC >> X;
high.resize(R);
for (auto& a:high){
a.resize(C); for (int& b:a) cin >> b;
}
Rescue(R,C,MR,MC,X);
}
for (auto [a,b]:ans) cout << a << ' ' << b << endl;
}
//*/
void Rescue(int R,int C,int MR,int MC,int X){
--MR;
int x = 0,y = MC-1;
while(x!=MR+1&&y!=-1){
int r = Measure(x+1,y+1);
if (r==X){
Pinpoint(x+1,y+1);
return;
}
if (r<X) ++x;
else --y;
}
x = 0,y = MC-1;
while(x!=MR+1&&y!=C){
int r = Measure(x+1,y+1);
if (r==X){
Pinpoint(x+1,y+1);
return;
}
if (r<X) ++x;
else ++y;
}
x = R-1,y = MC-1;
while(x!=MR+1&&y!=-1){
int r = Measure(x+1,y+1);
if (r==X){
Pinpoint(x+1,y+1);
return;
}
if (r<X) --x;
else --y;
}
x = R-1,y = MC-1;
while(x!=MR-1&&y!=C){
int r = Measure(x+1,y+1);
if (r==X){
Pinpoint(x+1,y+1);
return;
}
if (r<X) --x;
else ++y;
}
}
Compilation message
mountain.cpp:3:10: fatal error: mountain.h: No such file or directory
3 | #include "mountain.h"/*
| ^~~~~~~~~~~~
compilation terminated.