Submission #148564

# Submission time Handle Problem Language Result Execution time Memory
148564 2019-09-01T04:40:19 Z ummm(#3574, cerberus, aayush9, knandy) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
531 ms 18816 KB
#include "museum.h"
#include <bits/stdc++.h>

using namespace std;

long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) {
	int N = B.size();
	vector<vector<int> > v;
	v.push_back(B); v.push_back(T); v.push_back(G);
	long long ans = 0;
	for(int i = 0; i < 3; i++) {
		map<int, int> m;
		for(int j = 0; j < N; j++) {
			ans += m[v[i][j]];
			m[v[i][j]]++;
		}
	}
	for(int i = 0; i < 3; i++) {
		map<pair<int,int> , int> m;
		for(int j = 0; j < N; j++) {
			ans -= m[{v[(i+1)%3][j], v[(i+2)%3][j]}];
			m[{v[(i+1)%3][j], v[(i+2)%3][j]}]++;
		}
	}
	map<pair<pair<int,int>, int>, int> m;
	for(int i = 0; i < N; i++) {
		ans += m[{{v[0][i], v[1][i]}, v[2][i]}];
		m[{{v[0][i], v[1][i]}, v[2][i]}]++;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 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 512 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 7 ms 512 KB Output is correct
7 Correct 8 ms 512 KB Output is correct
8 Correct 8 ms 512 KB Output is correct
9 Correct 11 ms 640 KB Output is correct
10 Correct 10 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 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 512 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 7 ms 512 KB Output is correct
7 Correct 8 ms 512 KB Output is correct
8 Correct 8 ms 512 KB Output is correct
9 Correct 11 ms 640 KB Output is correct
10 Correct 10 ms 640 KB Output is correct
11 Correct 18 ms 896 KB Output is correct
12 Correct 23 ms 1536 KB Output is correct
13 Correct 136 ms 5708 KB Output is correct
14 Correct 195 ms 8168 KB Output is correct
15 Correct 319 ms 12016 KB Output is correct
16 Correct 89 ms 7532 KB Output is correct
17 Correct 184 ms 7400 KB Output is correct
18 Correct 413 ms 13692 KB Output is correct
19 Correct 503 ms 18816 KB Output is correct
20 Correct 531 ms 18796 KB Output is correct