Submission #148417

# Submission time Handle Problem Language Result Execution time Memory
148417 2019-09-01T04:20:40 Z Powered By Zigui(#3580, aaaa, evenharder, best_sheild97) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
98 ms 9328 KB
#include "museum.h"
using namespace std;
vector<int> b(101), t(101), g(101), bt(10101), tg(10101), bg(10101), btg(1010101);
int calc(int bb, int tt, int gg)
{
    return bb + 100*tt + 10000*gg;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {

    for(int i=0;i<B.size();i++)
    {
        B[i]--;
        G[i]--;
        T[i]--;
    }
    for(int i=0;i<B.size();i++)
    {
        b[B[i]]++;
        t[T[i]]++;
        g[G[i]]++;
        bt[100 * B[i] + T[i]]++;
        tg[100 * T[i] + G[i]]++;
        bg[100 * B[i] + G[i]]++;
        btg[10000 * B[i] + 100 * T[i] + G[i]]++;
    }
    long long ans = 0;
    for(int i=0;i<=100;i++)
    {
        ans += 1LL * b[i] * (b[i]-1) / 2LL;
        ans += 1LL * t[i] * (t[i]-1) / 2LL;
        ans += 1LL * g[i] * (g[i]-1) / 2LL;
    }
    for(int i=0;i<=10000;i++)
    {
        ans -= 1LL * bt[i] * (bt[i]-1) / 2LL;
        ans -= 1LL * tg[i] * (tg[i]-1) / 2LL;
        ans -= 1LL * bg[i] * (bg[i]-1) / 2LL;
    }
    for(int i=0;i<=1000000;i++)
    {
        ans += 1LL * btg[i] * (btg[i]-1) / 2LL;
    }
    return ans;
}

Compilation message

museum.cpp: In function 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:10:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<B.size();i++)
                 ~^~~~~~~~~
museum.cpp:16:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<B.size();i++)
                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 4480 KB Output is correct
2 Correct 10 ms 4480 KB Output is correct
3 Correct 10 ms 4480 KB Output is correct
4 Correct 9 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 10 ms 4480 KB Output is correct
7 Correct 10 ms 4480 KB Output is correct
8 Correct 10 ms 4480 KB Output is correct
9 Correct 11 ms 4480 KB Output is correct
10 Correct 10 ms 4480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 4480 KB Output is correct
2 Correct 10 ms 4480 KB Output is correct
3 Correct 10 ms 4480 KB Output is correct
4 Correct 9 ms 4480 KB Output is correct
5 Correct 10 ms 4480 KB Output is correct
6 Correct 10 ms 4480 KB Output is correct
7 Correct 10 ms 4480 KB Output is correct
8 Correct 10 ms 4480 KB Output is correct
9 Correct 11 ms 4480 KB Output is correct
10 Correct 10 ms 4480 KB Output is correct
11 Correct 12 ms 4608 KB Output is correct
12 Correct 21 ms 5248 KB Output is correct
13 Correct 34 ms 5688 KB Output is correct
14 Correct 46 ms 6388 KB Output is correct
15 Correct 64 ms 7540 KB Output is correct
16 Correct 87 ms 9324 KB Output is correct
17 Correct 89 ms 9328 KB Output is correct
18 Correct 93 ms 9328 KB Output is correct
19 Correct 98 ms 9324 KB Output is correct
20 Correct 96 ms 9328 KB Output is correct