#include "museum.h"
#include<map>
using namespace std;
long long count(std::vector<std::vector<int>> V) {
map<int, int> M;
for (int i = 0; i < V[0].size(); i++) {
int calc = 0;
for (int j = 0; j < V.size(); j++) {
calc = calc * 101 + V[j][i];
}
M[calc]++;
}
long long ret = 0;
for (auto p : M) {
ret += p.second * (p.second - 1LL) / 2;
}
return ret;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
long long sum = count({B}) + count({T}) + count({G});
sum -= count({B, T}) + count({T, G}) + count({B, G});
sum += count({B, T, G});
return sum;
}
Compilation message
museum.cpp: In function 'long long int count(std::vector<std::vector<int> >)':
museum.cpp:7:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < V[0].size(); i++) {
~~^~~~~~~~~~~~~
museum.cpp:9:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int j = 0; j < V.size(); j++) {
~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
8 ms |
384 KB |
Output is correct |
8 |
Correct |
8 ms |
508 KB |
Output is correct |
9 |
Correct |
9 ms |
640 KB |
Output is correct |
10 |
Correct |
8 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
6 ms |
384 KB |
Output is correct |
7 |
Correct |
8 ms |
384 KB |
Output is correct |
8 |
Correct |
8 ms |
508 KB |
Output is correct |
9 |
Correct |
9 ms |
640 KB |
Output is correct |
10 |
Correct |
8 ms |
384 KB |
Output is correct |
11 |
Correct |
15 ms |
1024 KB |
Output is correct |
12 |
Correct |
25 ms |
2592 KB |
Output is correct |
13 |
Correct |
90 ms |
5544 KB |
Output is correct |
14 |
Correct |
130 ms |
7960 KB |
Output is correct |
15 |
Correct |
206 ms |
11668 KB |
Output is correct |
16 |
Correct |
95 ms |
14472 KB |
Output is correct |
17 |
Correct |
155 ms |
14464 KB |
Output is correct |
18 |
Correct |
256 ms |
14584 KB |
Output is correct |
19 |
Correct |
359 ms |
18288 KB |
Output is correct |
20 |
Correct |
354 ms |
18296 KB |
Output is correct |