Submission #148495

# Submission time Handle Problem Language Result Execution time Memory
148495 2019-09-01T04:33:08 Z 还没编好(#3801, cauchysheep, fjzzq2002, apiad) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
566 ms 17388 KB
#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int N = B.size();
	map<int,int> sb[8];
	vector<int> S[3]={B,T,G};
	for(int i=0;i<N;++i)
	{
		for(int j=1;j<8;++j)
		{
			int w=0;
			for(int k=0;k<3;++k)
				if(j&(1<<k))
					w=w*233+S[k][i];
			++sb[j][w];
		}
	}
	long long a=0;
	for(int j=1;j<8;++j)
	{
		int k=-1;
		if(__builtin_popcount(j)&1) k=1;
		for(auto t:sb[j])
			a+=t.second*(ll)(t.second-1)/2*k;
	}
	return a;
}
#ifdef LOCAL
#include "grader.cpp"
#endif
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 7 ms 512 KB Output is correct
7 Correct 8 ms 640 KB Output is correct
8 Correct 7 ms 512 KB Output is correct
9 Correct 9 ms 768 KB Output is correct
10 Correct 9 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 7 ms 512 KB Output is correct
7 Correct 8 ms 640 KB Output is correct
8 Correct 7 ms 512 KB Output is correct
9 Correct 9 ms 768 KB Output is correct
10 Correct 9 ms 768 KB Output is correct
11 Correct 17 ms 1408 KB Output is correct
12 Correct 21 ms 1536 KB Output is correct
13 Correct 110 ms 6004 KB Output is correct
14 Correct 161 ms 8428 KB Output is correct
15 Correct 306 ms 11624 KB Output is correct
16 Correct 112 ms 7532 KB Output is correct
17 Correct 158 ms 7532 KB Output is correct
18 Correct 331 ms 12480 KB Output is correct
19 Correct 566 ms 17376 KB Output is correct
20 Correct 526 ms 17388 KB Output is correct