QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#95575#5473. Move One CoinPetroTarnavskyi#TL 1903ms71852kbC++173.1kb2023-04-10 16:10:572023-04-10 16:11:00

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-10 16:11:00]
  • 评测
  • 测评结果:TL
  • 用时:1903ms
  • 内存:71852kb
  • [2023-04-10 16:10:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

typedef unsigned long long ULL;

const int MAX = 1 << 11;
const int N = 1 << 10;
const int P = 1'000'000'007;
const int Q = 1'000'000'009;

ULL pwP[MAX], pwQ[MAX];

vector<string> r() {
	int n, m;
	cin >> n >> m;
	vector<string> res(n);
	for (string& s : res) {
		cin >> s;
	}
	return res;
}

unordered_map<ULL, pair<int, int>> getHashes(const vector<string>& s, ULL& h, multiset<int>& is, multiset<int>& js) {
	unordered_map<ULL, pair<int, int>> res;
	FOR(i, 0, SZ(s)) {
		FOR(j, 0, SZ(s[i])) {
			if (s[i][j] == 'o') {
				is.insert(i);
				js.insert(j);
				h += pwP[i] * pwQ[j];
			}
		}
	}
	FOR(i, 0, SZ(s)) {
		FOR(j, 0, SZ(s[i])) {
			if (s[i][j] == 'o') {
				is.erase(is.find(i));
				js.erase(js.find(j));
				res[is.empty() ? 0 : (h - pwP[i] * pwQ[j]) * pwP[N - *is.begin()] * pwQ[N - *js.begin()]] = {i, j};
				is.insert(i);
				js.insert(j);
			}
		}
	}
	return res;
}

vector<string> rotate(const vector<string>& s) {
	vector<string> res(SZ(s[0]), string(SZ(s), 'x'));
	FOR(i, 0, SZ(s)) {
		FOR(j, 0, SZ(s[i])) {
			res[j][SZ(s) - 1 - i] = s[i][j];
		}
	}
	return res;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	pwP[0] = pwQ[0] = 1;
	FOR(i, 1, MAX) {
		pwP[i] = pwP[i - 1] * P;
		pwQ[i] = pwQ[i - 1] * Q;
	}
	vector<string> src = r(), dst = r();
	ULL fhDst = 0;
	multiset<int> isDst, jsDst;
	unordered_map<ULL, pair<int, int>> hDst = getHashes(dst, fhDst, isDst, jsDst);
	FOR(t, 0, 4) {
		ULL fhSrc = 0;
		multiset<int> isSrc, jsSrc;
		unordered_map<ULL, pair<int, int>> hSrc = getHashes(src, fhSrc, isSrc, jsSrc);
		for (auto [h, ij] : hSrc) {
			auto [i, j] = ij;
			isSrc.erase(isSrc.find(i));
			jsSrc.erase(jsSrc.find(j));
			if (hDst.count(h)) {
				FOR(row, -N, N) {
					FOR(col, -N, N)	{
						if (row == i && col == j) {
							continue;
						}
						isSrc.insert(row);
						jsSrc.insert(col);
						//if ((h + pwP[row] * pwQ[col]) * pwP[N - *isSrc.begin()] * pwQ[N - *jsSrc.begin()] == fhDst)
						ULL h1 = (fhSrc - pwP[i] * pwQ[j]) * pwP[N - *isSrc.begin()] * pwQ[N - *jsSrc.begin()] + pwP[N - *isSrc.begin() + row] * pwQ[N - *jsSrc.begin() + col];
						ULL h2 = fhDst * pwP[N - *isDst.begin()] * pwQ[N - *jsDst.begin()];
						if (h1 == h2) {
							int n = SZ(src), m = SZ(src[0]);
							int x0 = i, y0 = j, x1 = row, y1 = col;
							FOR(l, 0, 4 - t) {
								x0 = n - 1 - x0;
								swap(x0, y0);
								x1 = n - 1 - x1;
								swap(x1, y1);
								swap(n, m);
							}
							cout << y0 << " " << x0 << " " << y1 << " " << x1 << "\n";
							return 0;
						}
						isSrc.erase(isSrc.find(row));
						jsSrc.erase(jsSrc.find(col));
					}
				}
			}
			isSrc.insert(i);
			jsSrc.insert(j);
		}
		src = rotate(src);
	}
	assert(false);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 121ms
memory: 3548kb

input:

2 3
xox
ooo
4 2
ox
ox
ox
ox

output:

1 0 -1 1

result:

ok OK! rot=1

Test #2:

score: 0
Accepted
time: 125ms
memory: 3544kb

input:

3 3
xox
oxo
xox
4 4
oxxx
xxox
xoxo
xxxx

output:

1 2 -1 -1

result:

ok OK! rot=0

Test #3:

score: 0
Accepted
time: 137ms
memory: 4112kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

498 498 0 0

result:

ok OK! rot=0

Test #4:

score: 0
Accepted
time: 182ms
memory: 4052kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0 498 498

result:

ok OK! rot=0

Test #5:

score: 0
Accepted
time: 174ms
memory: 4056kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

497 1 0 499

result:

ok OK! rot=0

Test #6:

score: 0
Accepted
time: 129ms
memory: 4016kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 499 497 1

result:

ok OK! rot=0

Test #7:

score: 0
Accepted
time: 60ms
memory: 4144kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 498 -498 996

result:

ok OK! rot=3

Test #8:

score: 0
Accepted
time: 183ms
memory: 4184kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0 498 498

result:

ok OK! rot=1

Test #9:

score: 0
Accepted
time: 67ms
memory: 4008kb

input:

500 500
xooxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

1 0 -497 -498

result:

ok OK! rot=0

Test #10:

score: 0
Accepted
time: 187ms
memory: 4060kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0 498 498

result:

ok OK! rot=0

Test #11:

score: 0
Accepted
time: 125ms
memory: 4224kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

498 1 0 499

result:

ok OK! rot=3

Test #12:

score: 0
Accepted
time: 183ms
memory: 4244kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0 498 498

result:

ok OK! rot=1

Test #13:

score: 0
Accepted
time: 1587ms
memory: 71852kb

input:

500 500
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

70 419 483 173

result:

ok OK! rot=0

Test #14:

score: 0
Accepted
time: 798ms
memory: 29072kb

input:

302 302
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

256 0 0 180

result:

ok OK! rot=0

Test #15:

score: 0
Accepted
time: 1903ms
memory: 29660kb

input:

302 302
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxx...

output:

287 0 0 63

result:

ok OK! rot=1

Test #16:

score: 0
Accepted
time: 326ms
memory: 4340kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

250 0 250 500

result:

ok OK! rot=0

Test #17:

score: 0
Accepted
time: 242ms
memory: 4460kb

input:

499 499
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

498 0 249 249

result:

ok OK! rot=3

Test #18:

score: 0
Accepted
time: 124ms
memory: 3544kb

input:

3 3
oxo
xox
oxo
3 4
oxox
xxxo
oxox

output:

1 1 3 1

result:

ok OK! rot=0

Test #19:

score: 0
Accepted
time: 127ms
memory: 3472kb

input:

3 3
oxo
xox
oxo
4 3
xox
oxo
xxx
oxo

output:

1 1 1 -1

result:

ok OK! rot=0

Test #20:

score: 0
Accepted
time: 67ms
memory: 4072kb

input:

500 500
oooxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

499 499 -497 -498

result:

ok OK! rot=0

Test #21:

score: 0
Accepted
time: 245ms
memory: 4020kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0 996 997

result:

ok OK! rot=0

Test #22:

score: 0
Accepted
time: 93ms
memory: 4156kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 499 976 -477

result:

ok OK! rot=0

Test #23:

score: 0
Accepted
time: 112ms
memory: 3520kb

input:

1 2
oo
1 3
oxo

output:

1 0 -2 0

result:

ok OK! rot=0

Test #24:

score: 0
Accepted
time: 119ms
memory: 3448kb

input:

1 2
oo
2 2
ox
xo

output:

1 0 -1 -1

result:

ok OK! rot=0

Test #25:

score: 0
Accepted
time: 145ms
memory: 3548kb

input:

10 10
oooxxxxoxx
xoxoxxxxxx
xooxxooxoo
ooxoxoxxoo
oooooxxoxx
xxxoxxoxox
oxoxxxxxox
xoxoxoxxoo
xooxxxxoxx
xxxxxxxoxx
10 10
xooxxxxoxx
xoxoxxxxxx
xooxxooxoo
ooxoxoxxoo
oooooxxoxx
xxxoxxoxox
oxooxxxxox
xoxoxoxxoo
xooxxxxoxx
xxxxxxxoxx

output:

0 0 3 6

result:

ok OK! rot=0

Test #26:

score: 0
Accepted
time: 142ms
memory: 3532kb

input:

11 9
xoxxoxoox
xxxxxxoxx
xoxoxxoxx
oxoooxooo
oxxxxxxxx
xxoxoxoxx
xxooxxxxo
oxooxooox
xxoxxxxxx
oxxoxxxox
xxxxxooxx
9 11
xoxoxxooxxx
xxxxxxxxoxo
xxooooxoxxx
xoxooxxooxx
xxxxooxoxxx
oxxoxxxxxxx
oxxoxoxoooo
xoxoxxxoxxo
xxxxoxxoxxx

output:

4 0 4 6

result:

ok OK! rot=3

Test #27:

score: 0
Accepted
time: 135ms
memory: 3476kb

input:

8 13
xxxxoxxxxxxxx
oxxxoxxxxxxxo
oxxxoxxxxxxxo
oxoxxxxxoxxxx
xoxxxxooxxxxx
xoxxoooxxxxxx
xoxxxxoxxoxxo
xoxxxxoxxxxox
8 13
xxxxxooxxxxox
oxxoxxoxxxxox
xxxxxxoooxxox
xxxxxooxxxxox
xxxxoxxxxxoxo
oxxxxxxxoxxxo
oxxxxxxxoxxxo
xxxxxxxxoxxxx

output:

11 7 7 7

result:

ok OK! rot=2

Test #28:

score: 0
Accepted
time: 143ms
memory: 3472kb

input:

7 16
xoxoxoxooxoxoxoo
xxxxoxxxoxxooxxx
xooxoxxooxxxoxox
oxxoxxxxxxoooxxx
xxxxoxxoxxxxxoxx
xxoxxxxoxoxoxxxx
xoooooxooxoxoxxx
7 16
xxxoooxxoxooooox
xxxxoxoxoxxxxoxx
xxoxxxxxoxxoxxxx
xxxoooxxxxxxoxxo
xoxoxxxooxxoxoox
xxxooxxoxxxoxxxx
ooxoxoxooxoxoxox

output:

8 6 11 6

result:

ok OK! rot=2

Test #29:

score: 0
Accepted
time: 141ms
memory: 3468kb

input:

14 7
xxxxxox
oxooxxx
xxooxox
xxxooxx
oxxoxxx
xooxxox
xxxoxxx
oxxoxxx
oooxxox
xoxoxxx
xxxoxox
ooxxxxx
xxooxox
ooxxxxo
14 6
oxxxoo
oxooxx
xxxxoo
oxoxxx
xxoxox
oxxooo
xxoxxo
xxoxxx
oxxoox
xxoxxo
xooxxx
oxooxx
xxooxo
oxxxxx

output:

6 13 5 13

result:

ok OK! rot=2

Test #30:

score: 0
Accepted
time: 131ms
memory: 3544kb

input:

4 10
oooxxoxxox
xoxxxoxxxo
oxxxxxxxxx
oxxoxxxxox
12 4
xxxo
xxxx
ooxx
xxoo
xxxo
oxxx
xxxx
xxoo
xxxx
xxxx
oxxo
xxox

output:

0 0 -2 0

result:

ok OK! rot=3

Test #31:

score: 0
Accepted
time: 141ms
memory: 3556kb

input:

9 9
xxxoxxoxo
xxxxoxxxx
xoxxxoxox
xxooxxxxo
xxxxoxoxx
oooxooxox
xxxxxxxox
oxxxoxxox
ooooxxxxo
10 9
oxxxxoooo
xoxxoxxxo
xoxxxxxxx
xoxooxooo
xxoxoxxxx
oxxxxooxx
xoxoxxxox
xxxxoxxxx
oxoxxxxxx
xxxxxoxxx

output:

3 0 3 -1

result:

ok OK! rot=2

Test #32:

score: 0
Accepted
time: 137ms
memory: 3460kb

input:

12 9
xxoxoxxxx
xxxxxxxxx
xoxxxxxxx
xxoxxxxxx
ooxxxoxxx
xxxxoxoxo
xxxoxxxxx
xxxxxoxxx
xooxxxxxx
oxxxooxxx
xoxoxxxxx
xoxxoxoxx
8 12
xxxxxxoxxxxx
xxxxxoxxxxxo
xxxxoxxoxoxx
oxxxxoxxxoxo
xxxxxxoxxxox
oxxoxxxxoxxx
xxoxoxxxoxoo
xxxxoxxxxoxx

output:

8 5 7 6

result:

ok OK! rot=1

Test #33:

score: 0
Accepted
time: 193ms
memory: 3800kb

input:

50 50
oxxooxoooxoooxxoooxxxooxxooxxooxooxooooxoxxxooxxxx
xxoooooxooxxxxxooxxxxxoxooooxooxxxoxxxxoxxoooooxox
ooooooooxxxooxxooxoooxoxoxoooxxxxoxoxoxooooooxooxo
xooooxoxxxoxoxxxxoxoxoxxoxooxxooxxoooxooxxoxxxoxox
xoxxxxoxxxxoxxxooooooxoooxoxoxxoooooooxoooooooxoxx
xoxoxooxxxoxooxoxxooxxxxxxxxxxoxooxxxoo...

output:

17 25 40 36

result:

ok OK! rot=0

Test #34:

score: 0
Accepted
time: 190ms
memory: 3836kb

input:

50 50
xxxoxoxxxooxxoxooxoooxoxxooooxoxooooxxoxxxxxxoxooo
xoxxxoxxoxxxoxxxoxoooxxxoxxxoxooxoxoxooooxooooxxoo
oxoxxoooxxooooxxxxooxxoxxoooxxxoxoxooxxoxoxxoxxxxx
xxoxxoooxxoooxxxxxxooxxxoooooxooxoxooxxooooxxxoxxo
ooxxoxoxoooxxoooxoxooxxoxoxxxoxxoxooxxxxooooxooxox
xoxxxooooxooxxxoxxxxxooxxxoooooxxoxooxx...

output:

8 9 28 18

result:

ok OK! rot=1

Test #35:

score: 0
Accepted
time: 193ms
memory: 3852kb

input:

50 50
ooxooxxxoxoooooxoxoxooxoooooooxxoooxoxoooooxxxoxoo
xoxoxxxoxxxooxoooxxoooooooooxoxooooxoooooooxxxoxoo
xxxxxooxooxxxxxxxxxooooxooxxxxoxxoxxoxoooxxxxxxoox
ooxoxoxxxxxxxoxoxoxooxxoooxooxxooxooxxoxoxxooooxoo
oxoxoxxxxooxoxoxoxxoooooxxooxoxxoxooooxoxxxooooxox
oxxxoxxxxxoooxxxoooxxxxxoooooxoxooxooox...

output:

39 4 23 13

result:

ok OK! rot=0

Test #36:

score: 0
Accepted
time: 195ms
memory: 3952kb

input:

50 50
xxoxxoxoxooooxooooxoxxooxooxoooxoxoooxoxooxxoxxxxx
xxooxooooxooxooooooooxoxxxxxooooxooooooxxxoooxxoxo
xxxoooxxxooxxxoxoooxoxoooooxooxoxxxxxoooxxoxoxxoox
ooxxxooxxoxxxoooxxxoxoxxxooooxoxoooxoxoooxxoxooooo
oxoxoooooxxxooxxoxooxoooooxoxxxooxoxoxxxoxxxxooxxx
ooooooxxxxoooxxxoxoxooxoxoxxoxxoooxxxxx...

output:

20 49 47 45

result:

ok OK! rot=2

Test #37:

score: 0
Accepted
time: 188ms
memory: 3876kb

input:

50 50
ooooxxoxxxxxoooxoooooxoxoxxxxxooxxooxoxooxxoooxoxx
xoooxoxoxooxxoxxxooooooxxoxxxoxxxooxoxoxoxooooxxxo
xoxoxooxoxxooxoxoooxxooxxoxooxoxoxxooxoxooooxoxooo
oooooooooxxoxxooxoooooxxoooxooxooxxoxooxxooxoxxooo
xxxoxoxxoxooxoooxooxxoxoxxooxxoxoxoxxoxoxoxoxxooox
xooxxooxxxoxxoxoxoxxxxxoxooxxxoooxxoxxx...

output:

49 32 35 22

result:

ok OK! rot=0

Test #38:

score: 0
Accepted
time: 178ms
memory: 3876kb

input:

50 50
oxxxxxooxxoxxxxoxoxooxxooooxxoxooxoxoxooxooxxoxxox
xxooxooxoxxoxxoxxoxxxoooxoxxoxoxooxoxxxoxxxoxooxxx
oooxxxxoxxxoxxoxxxxooxxoooxoxoxoxooxoxxxoxxxoxooxo
oxooxxxoxooxooooxoxxxxoxxooxoxoxxxooooxooxxoxooxxo
oxxoxooxooxxxxxxoooxxxxooxoooxxxxoxxoxxooxoxxooxxo
xooooooooxxoxoxoooxooxoxxoxxxxxxoxoooxo...

output:

49 23 40 40

result:

ok OK! rot=2

Test #39:

score: 0
Accepted
time: 189ms
memory: 3916kb

input:

50 50
oxoooxxoooxoxoxoxxxooxxxoxxxoxoxoxooxxxxoxoxooooxx
ooxoooxoxxxoxoooxxoxxxoxooxoxoxxoxxoooxxxxoxooxoox
xxoxxoooxoooooxoxxooxoxxooxxxxoxooxxxxxooxoxxxxxxo
ooxxoxooxxxoxoxooxoxoxxoooxoxxoxoxooooxxxxooooxoxo
ooxooxxxxoooooooxxoxxoooxooxoooxxoxxooxxxoooxoxoox
xoooooooxxoxoxoooxxxooxoxxxooxxxxxoxoxo...

output:

31 23 52 11

result:

ok OK! rot=3

Test #40:

score: 0
Accepted
time: 183ms
memory: 3896kb

input:

50 50
ooxxoxoxxoxoxoxooxoxxxoxoxxooooxxooxxooooxxxxxxoox
oxxxxooooxxxoxxxxoxxooxxoxooxooxxxooxxxxooooxxxxxx
oooxoxoxoxoooxoooxxxoooxxooooxxxoxoxoooxoxxoxxoooo
ooxxxoxxoxxoxooxoxoxxoxxxoooxxxxxxxooxxxxxoxxxxoxx
oxxoxxxooxxoxoxxxxxxoxoxxxoxxxxooxxxxooxxoxxxxxoxo
xooooxoooooxxooxoxxxoxooxxxoxooxxxoxxxx...

output:

35 9 52 3

result:

ok OK! rot=1

Test #41:

score: 0
Accepted
time: 190ms
memory: 3844kb

input:

50 50
xooxxoxxoooxxxxoxxxoooxoxoooxoxxxooxxxxooxxxxoooox
ooxxoxoxxxxxxxoooooooooxooooxoooxoxoxoxxooxooxxoox
xxooxxoxoxxooooxxxxxxxxoxxxxoxooxoxxxxoxxooxxxooxx
xxooooxxxxoxxoxxooxoxoooxoxxoxoxxxxoxooxxxxxxoxoox
xoooxoxxoxooooxooxoxxxooxxxxxxooooooxxxooooxxxxoxo
ooxxoxxxxxooxooxxoxoxooxxxoooxoxoxooxox...

output:

4 22 43 -3

result:

ok OK! rot=1

Test #42:

score: 0
Accepted
time: 197ms
memory: 3956kb

input:

50 50
oooooooxooxxoxxoxxxoxxoxooooxoxoxxxxoooxoxoxxooxxx
oooxoxooxxxoooooxoooxoxxoxxxoxoxxxoooxoxoxxoooxooo
oxxxxxoxxoxoxxxoxoxxooxoxxxxxooxxxxoxoxxoooxoxxxox
ooxoxxxxoxooxoxxooxooooooxoooxooooxxooooxxxxxoooxx
xxxxxxxxxxoooooooxooxooxooxooooxxxooooooxoxxoxoxox
xxoxoxxooxooxxxooxoxoxxoxoxxoxoxooxooxo...

output:

0 12 52 18

result:

ok OK! rot=2

Test #43:

score: 0
Accepted
time: 185ms
memory: 3912kb

input:

50 50
oxxoxxxoxxxooxooxxxxoxxooxxxoxoxxooooxxxoxxxoxooox
xxoxoxooooxoxxooxooooooxooooxoooxoxoxxoxxoxoooxooo
xxoooxoxoxooxxoxxoxxxxxoooxxxoxxxoooxoxoooxxxooxxo
ooxooxxooxxxooxoooooxxxxxoxxoooooxoxooooooooxxxoxx
xoxoxoxxxxxoxoxoxxooxxxooxxxoxooooxxoxxoooooxooxoo
xooxxxxxoxxxxxxxxxoxooxooxoooxxoxoooooo...

output:

20 49 52 -2

result:

ok OK! rot=0

Test #44:

score: 0
Accepted
time: 184ms
memory: 3836kb

input:

50 50
xooxxooxxoxoxxoxoxxooxxxxoxoxooxoooooooxxooxxooxoo
oooxxoxoxoxooxxooxooooxooxooooxxxxoooxooxxooxoooox
oxxxoxxxxoxxoxxoxxoxxxxxoxxooxoooxoooxxxoxoxoooxoo
ooxooxoxoxxxooooooxoooooxoxooxooxxxxxxxoxxxxxoxooo
oxxooxxxxooxxxxxoxxoooxxxxoxxxxxxxxooxoxxoxooxoxxo
xooxxooxoooxxooxoxoxxxxxxxxxxxxooooooox...

output:

22 49 10 -3

result:

ok OK! rot=1

Test #45:

score: 0
Accepted
time: 935ms
memory: 12280kb

input:

250 250
oxxoxxxxxxxxoxoooxxxxoooxoxxxoxxoxoxxoxoooxxxxoxxoooooxoooxxoooxxoxxoooxxooxxoxoooooooxoxxooxoxooooxooooxooxxxoooooxoxxxxxooxxoooxooxoxoooxxxoooxxxooooxxoxooxxoxxooxxxxoooxxooxxooooxxxxxxooxxxooooxoooxoxxoxoxxoxxxxoxoooxxoooxoxooooxoxxoxxxoooxoxooooo
xoooooxoxxooxoooooxoxoooooooxxooxoooxxoxo...

output:

178 249 -250 305

result:

ok OK! rot=1

Test #46:

score: 0
Accepted
time: 437ms
memory: 12096kb

input:

250 250
oooxoxxxooooooxxxxxoxxoxxoxoxoooooooooxoxxxxoooxxxoxoooxoxoxooooxxoooxxoxoxoxoooxoooxxxxoooooxxxoxxoxxxoooxoooxxooxoxoxxooxxoxoxxxooxoxxoooxooooxxxxxxxoxxooxoxxxxoxoooxoxxoxoxxxxoxooxxxooxoooxooooxoxxoooxooxxxoxxxoooxxoxxxoxoxooxxoxxxoooxoxoxxoooxxxx
xxoxoxxoooxoxooxxoxooxxxoxxxooxxxooooxooo...

output:

155 249 -250 50

result:

ok OK! rot=3

Test #47:

score: 0
Accepted
time: 731ms
memory: 12308kb

input:

250 250
oxxooxooxxoooooooxxxxoxooxxxooxoxxxxoxoxxxoxxxxooxoxooxxxxxxxxooooooxoooooxoxxoxooxoooxxoxooxoxxoxoxxooxoooooooxoxoooxoooxxoxoxoooooxxxooxoxxoxxooooxooxooxoxxxxoxoooxoooxoxooxxxxxooooxooxxxoooxooxxoooxoxxxxoxoxooxxooooxxxoxxooooxxooxoxxooxxooooxoooox
xxxooxoooooxxoxxoxxxoxoooxoxxxxxxooxoxxxo...

output:

249 154 260 -250

result:

ok OK! rot=3

Test #48:

score: 0
Accepted
time: 1131ms
memory: 37432kb

input:

500 500
xooxoxooxoxooxoxoxxxxxoooooxoxxxoxoooxooxxoxxxoxxxoxoooxxooooxxxoxxxooooxooooxoxxxoxoooxxxoxxxooxxoxxoooxoxoxoxxoooxoxxooxxoxoxoxxxxxxoxoxxxxxoooxxxxxxoxxooxoxxxoooxxxooxxoxoooxoxooooxoooxooxooxooxoooxooooxoxoxxxxxoxxxxoooxxoooooxoooxoxooxoxoxooxoxxoxoxoxooooxoxoxxxooxxxxxxxoxxxooxooxooxxxoo...

output:

188 120 390 104

result:

ok OK! rot=0

Test #49:

score: 0
Accepted
time: 1766ms
memory: 38828kb

input:

500 500
xxoxoxoxoxooxxxxxxoooxxoxxoxxxoxoxooooxxoxoxoooooxoooxxxoxxxooooxoxoxxxxxoxxoxoooxoxxxoxxoxoxooxxxxoxxxoxooxxxooooxxxoxxooxxxooxxxxooooooxoxoxoxoxoooxxoooxxooooxxxxoxoxooxxxoooxooooooooxoooooooooooxooxooooooxoxooooxoxxooxxooooooooxooooooxooxoxooooxooooxoooxoxxxooxoxxoooooooxxxooooxoooxoxoooo...

output:

98 295 62 338

result:

ok OK! rot=3

Test #50:

score: -100
Time Limit Exceeded

input:

500 500
xoxooxxooxxooxooxxoxxxoooxxooooxooxxooxxxxxxxxoxxooxoooooxxooxxxoxxxxoxxoxxxooooooxxxoxxxoxxoxxxxoxxoxxoxooxooxxoxxxoooxxoooxxxooooooxooxxxxoxxooxxxooxxxoooxoxxxxxxoxxxoxxxxxooxooxxxxxoxoxxooxxooxoxxxoxxooxxooooxxxoxxxoxooxxxxoxoxxxoxoooooooooooxooxoxxoxoxoooxxxxxxxxxxoxoooxoxxoxoooxoxxxxxxx...

output:


result: