답안 #850147

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
850147 2023-09-15T21:47:23 Z angels 함수컵 박물관 (FXCUP4_museum) C++17
0 / 100
4 ms 4640 KB
#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int N = B.size();
	int b[101], t[101], g[101], bt[101][101], bg[101][101], tg[101][101], btg[101][101][101];
	long long result=0;
	for(int i=0; i<N; i++)
    {
        b[B[i]]++;
        t[T[i]]++;
        g[G[i]]++;
        bt[B[i]][T[i]]++;
        bg[B[i]][G[i]]++;
        tg[T[i]][G[i]]++;
        btg[B[i]][T[i]][G[i]]++;
    }
    for(int i=0; i<100; i++)
    {
        result+=((b[i])*(b[i]-1))/2;
        result+=((t[i])*(t[i]-1))/2;
        result+=((g[i])*(g[i]-1))/2;
    }
    for(int i=0; i<100; i++)
    {
        for(int j=0; j<100; j++)
        {
            result-=((bt[i][j])*(bt[i][j]-1))/2;
            result-=((tg[i][j])*(tg[i][j]-1))/2;
            result-=((bg[i][j])*(bg[i][j]-1))/2;
        }
    }
	for(int i=0; i<100; i++)
    {
        for(int j=0; j<100; j++)
        {
            for(int k=0; k<100; k++)
                result+=((btg[i][j][k])*(btg[i][j][k]-1))/2;
        }
    }
	return result;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4640 KB Output is correct
2 Correct 3 ms 4440 KB Output is correct
3 Correct 4 ms 4440 KB Output is correct
4 Correct 3 ms 4440 KB Output is correct
5 Incorrect 4 ms 4440 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4640 KB Output is correct
2 Correct 3 ms 4440 KB Output is correct
3 Correct 4 ms 4440 KB Output is correct
4 Correct 3 ms 4440 KB Output is correct
5 Incorrect 4 ms 4440 KB Output isn't correct
6 Halted 0 ms 0 KB -