#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
using ll = long long;
const int mod = 998244353;
void Rescue(int R, int C, int MR, int MC, int X){
	int x, y, s;
	x = MR;
	y = 1;
	while ( y < MC ) {
		while (x >= 1) {
			s =  Measure(x, y);
			if ( s > X) x --;
			else {
				if (s == X) {
					Pinpoint(x, y);
				}
				else break;
			}
		}
		y ++;
	}
	x = MR;
	y = C;
	while ( y >= MC ) {
		while (x >= 1) {
			s =  Measure(x, y);
			if ( s > X) x --;
			else {
				if (s == X) {
					Pinpoint(x, y);
				}
				else break;
			}
		}
		y --;
	}
	x = MR;
	y = 1;
	while ( y < MC ) {
		while (x <= R) {
			s =  Measure(x, y);
			if ( s > X) x ++;
			else {
				if (s == X) {
					Pinpoint(x, y);
				}
				else break;
			}
		}
		y ++;
	}
	x = MR;
	y = C;
	while ( y >= MC ) {
		while (x <= R) {
			s =  Measure(x, y);
			if ( s > X) x ++;
			else {
				if (s == X) {
					Pinpoint(x, y);
				}
				else break;
			}
		}
		y --;
	}
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |