1
class Solution {
2
public:
3
unordered_map<int, int> table;
4
int y, x;
5

6
Solution(int m, int n) {
7
y = m, x = n;
8
}
9

10
vector<int> flip() {
11
int Y = rand() % y, X = rand() % x, id;
12

13
while (table.count(id = (Y << 14) + X)) {
14
if (++X == x) X = 0, Y++;
15
if (Y == y) Y = 0;
16
}
17

18
table[id] = 1;
19
return {Y, X};
20
}
21

22
void reset() {
23
table.clear();
24
}
25
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0