#include "museum.h"
#include <string>
#include <algorithm>
#include <map>
void score(std::map<std::string, int>& m, int i, int j) {
std::string s;
s.append(std::to_string(i));
s.append(std::to_string(j));
sort(s.begin(), s.end());
m[s]++;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
std::map<std::string, int> m;
for (int i = 0; i < N; i++) {
int candB = B[i];
int candT = T[i];
int candG = G[i];
for (int j = 0; j < N; j++) {
// 같으면 continue
if (i == j) {
continue;
}
if (candB == B[j]) {
score(m, i, j);
continue;
}
if (candT == T[j]) {
score(m, i, j);
continue;
}
if (candG == G[j]) {
score(m, i, j);
continue;
}
}
}
return m.size();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |