This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cstring>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int cards[n][k];
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < k; j++) {
cards[i][j] = s[j] - '0';
}
}
int count = 0;
for (int i = 0; i < n-2; i++) {
for (int j = i+1; j < n-1; j++) {
bool is_set = true;
for (int l = 0; l < k; l++) {
int sum = cards[i][l] + cards[j][l] + cards[n-1][l];
if (sum % 3 != 0 && sum % 3 != 3) {
is_set = false;
break;
}
}
if (is_set) {
count++;
}
}
}
cout << count << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |