답안 #149991

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149991 2019-09-01T07:30:33 Z test team(#3596, leesongun, einsu5, willi19) 함수컵 박물관 (FXCUP4_museum) C++17
컴파일 오류
0 ms 0 KB
#include "museum.h"
long long a[101],b[101],c[101],d[101][101],e[101][101],f[101][101],g[101][101][101];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int n = B.size();
	long long ret=0;
	for(int i=0;i<n;i++)
    {
        a[B[i]]++;
        b[T[i]]++;
        c[G[i]]++;
        d[B[i]][T[i]]++;
        e[B[i]][G[i]]++;
        f[T[i]][G[i]]++;
        g[B[i]][T[i]][G[i]]++;
    }
    for(int i=1;i<=100;i++)
        ret+=((a[i]-1)*a[i]+(b[i]-1)*b[i]+(c[i]-1)*c[i])/2;
    for(int i=1;i<=100;i++)
        for(int j=1;j<=100;j++)
            ret-=((d[i][j]-1)*d[i][j]+(e[i][j]-1)*e[i][j]+(f[i][j]-1)*f[i][j])/2;
    for(int i=1;i<=100;i++)
        for(int j=1;j<=100;j++)
            for(int k=1;k<=100;k++)
                ret+=(f[i][j][k]-1)*f[i][j][k]/2;
    return ret;
}

Compilation message

museum.cpp: In function 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:24:32: error: invalid types 'long long int[int]' for array subscript
                 ret+=(f[i][j][k]-1)*f[i][j][k]/2;
                                ^
museum.cpp:24:46: error: invalid types 'long long int[int]' for array subscript
                 ret+=(f[i][j][k]-1)*f[i][j][k]/2;
                                              ^