Submission #715097

#TimeUsernameProblemLanguageResultExecution timeMemory
715097keystoneSet (COCI21_set)C++14
0 / 110
2 ms212 KiB
#include <iostream> #include <cstring> using namespace std; int main() { int n, k; cin >> n >> k; char cards[n][k + 1]; for (int i = 0; i < n; i++) { cin >> cards[i]; } long long count = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { bool is_set = true; for (int p = 0; p < k; p++) { if (cards[i][p] == cards[j][p]) { for (int q = j + 1; q < n; q++) { if (cards[i][p] != cards[q][p] && cards[j][p] != cards[q][p]) { is_set = false; break; } } if (!is_set) { break; } } else { if (cards[i][p] != '1' && cards[j][p] != '1' && cards[i][p] != cards[j][p]) { if (cards[i][p] == '2' || cards[j][p] == '2') { for (int q = j + 1; q < n; q++) { if (cards[q][p] != '1' && cards[i][p] != cards[q][p] && cards[j][p] != cards[q][p]) { is_set = false; break; } } if (!is_set) { break; } } else if (cards[i][p] == '3' || cards[j][p] == '3') { for (int q = j + 1; q < n; q++) { if (cards[q][p] == '3' || cards[i][p] == cards[q][p] || cards[j][p] == cards[q][p]) { is_set = false; break; } } if (!is_set) { break; } } } else { is_set = false; break; } } } if (is_set) { count++; } } } cout << count << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...