답안 #151159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151159 2019-09-01T22:49:43 Z kuroni 함수컵 박물관 (FXCUP4_museum) C++17
100 / 100
94 ms 11316 KB
#include "museum.h"
#include <bits/stdc++.h>
using namespace std;

const int MX = 105;

int n, cnt[MX][MX][MX];

int &get(int a, int b, int c, int msk)
{
	if (!(msk & 1))
		a = 0;
	if (!(msk & 2))
		b = 0;
	if (!(msk & 4))
		c = 0;
	return cnt[a][b][c];
}

long long CountSimilarPairs(vector<int> b, vector<int> t, vector<int> g)
{
	int n = b.size();
	long long ans = 0;
	for (int i = 0; i < n; i++)
		for (int msk = 1; msk < 8; msk++)
			ans += ((__builtin_popcount(msk) & 1) ? 1 : -1) * (get(b[i], t[i], g[i], msk)++);
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 632 KB Output is correct
5 Correct 4 ms 2168 KB Output is correct
6 Correct 5 ms 2424 KB Output is correct
7 Correct 6 ms 3192 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 7 ms 4216 KB Output is correct
10 Correct 8 ms 4216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 632 KB Output is correct
5 Correct 4 ms 2168 KB Output is correct
6 Correct 5 ms 2424 KB Output is correct
7 Correct 6 ms 3192 KB Output is correct
8 Correct 3 ms 504 KB Output is correct
9 Correct 7 ms 4216 KB Output is correct
10 Correct 8 ms 4216 KB Output is correct
11 Correct 9 ms 4856 KB Output is correct
12 Correct 13 ms 1272 KB Output is correct
13 Correct 31 ms 6004 KB Output is correct
14 Correct 42 ms 7404 KB Output is correct
15 Correct 57 ms 8808 KB Output is correct
16 Correct 73 ms 6272 KB Output is correct
17 Correct 75 ms 6460 KB Output is correct
18 Correct 83 ms 8164 KB Output is correct
19 Correct 94 ms 11316 KB Output is correct
20 Correct 94 ms 11244 KB Output is correct