Submission #148603

#TimeUsernameProblemLanguageResultExecution timeMemory
148603코딩은 체육과목입니다 (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
96 ms14060 KiB
#include "museum.h"
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#define all(x) (x).begin(), (x).end()
#define xx first
#define yy second

using namespace std;

using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

i64 counts[105][105][105];
i64 bcounts[105];
i64 tcounts[105];
i64 gcounts[105];
i64 btcounts[105][105];
i64 tgcounts[105][105];
i64 bgcounts[105][105];

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
    i64 n = B.size();

    for (int i = 0; i < n; i++)
    {
        counts[B[i]][T[i]][G[i]]++;
        bcounts[B[i]]++;
        tcounts[T[i]]++;
        gcounts[G[i]]++;
        btcounts[B[i]][T[i]]++;
        bgcounts[B[i]][G[i]]++;
        tgcounts[T[i]][G[i]]++;
    }

    i64 ans = 0;

    for (int i = 1; i <= 100; i++)
    {
        for (int j = 1; j <= 100; j++)
        {
            for (int k = 1; k <= 100; k++)
            {
                i64 pairs = bcounts[i] + tcounts[j] + gcounts[k];
                pairs -= btcounts[i][j] + bgcounts[i][k] + tgcounts[j][k];
                pairs += counts[i][j][k];

                ans += counts[i][j][k] * (pairs - 1);
            }
        }
    }

    return ans / 2;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...