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 "museum.h"
#include <string>
#include <algorithm>
#include <set>
std::set<std::string> m;
void score(int i, int j) {
std::string s;
s.append(std::to_string(i));
s.append(std::to_string(j));
sort(s.begin(), s.end());
if (!m.count(s))
m.insert(s);
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
for (int i = 0; i < N; i++) {
int candB = B[i];
int candT = T[i];
int candG = G[i];
for (int j = i+1; j < N; j++) {
if (candB == B[j]) {
score(i, j);
}
if (candT == T[j]) {
score(i, j);
}
if (candG == G[j]) {
score(i, j);
}
}
}
return (long long)m.size();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |