# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
715098 |
2023-03-25T22:23:58 Z |
keystone |
Set (COCI21_set) |
C++14 |
|
2 ms |
212 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |