// 2024 IUSB Programming Competition // Round 1 Problem 6 // Latin Square // Solution by Liguo Yu #include #include #include using namespace std; int main() { int size; cin >> size; vector> data(size, vector(size)); for(int i=0; i> data[i][j]; } } vector> rows(size); vector> cols(size); for(int i = 0; i < size; i++) { rows[i] = unordered_set(); cols[i] = unordered_set(); } bool valid = true; for(int i = 0; i < size; i++) { for(int j = 0; j < size; j++) { rows[i].insert(data[i][j]); cols[j].insert(data[i][j]); } } if(rows[0].size() != size) { valid = false; } else { for(int i=0; i