1class Solution {2public:3unordered_map<int, int> table;4int y, x;56Solution(int m, int n) {7y = m, x = n;8}910vector<int> flip() {11int Y = rand() % y, X = rand() % x, id;1213while (table.count(id = (Y << 14) + X)) {14if (++X == x) X = 0, Y++;15if (Y == y) Y = 0;16}1718table[id] = 1;19return {Y, X};20}2122void reset() {23table.clear();24}25};