Submission #148523

# Submission time Handle Problem Language Result Execution time Memory
148523 2019-09-01T04:35:51 Z 1 WA = 5 Push Up(#3624, BaaaaaaaaaaaaaaaarkingDog, IohcEjnim, 0xrgb) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
223 ms 13856 KB
#include <unordered_map>
#include "museum.h"

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
    const int N = B.size();
    std::unordered_map<int, int> a, b, c;

    for (int i = 0; i < N; ++i) {
        ++a[B[i]];
        ++a[T[i] + 201];
        ++a[G[i] + 401];
        ++b[B[i] * 100 + T[i]];
        ++b[T[i] * 100 + G[i] + 20001];
        ++b[G[i] * 100 + B[i] + 40001];
        ++c[B[i] * 10000 + T[i] * 100 + G[i]];
    }

    long long ans = 0;
    for (const auto& it : a) {
        ans += it.second * (long long)(it.second - 1) / 2;
    }
    for (const auto& it : b) {
        ans -= it.second * (long long)(it.second - 1) / 2;
    }
    for (const auto& it : c) {
        ans += it.second * (long long)(it.second - 1) / 2;
    }

    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 6 ms 512 KB Output is correct
7 Correct 7 ms 560 KB Output is correct
8 Correct 6 ms 512 KB Output is correct
9 Correct 7 ms 768 KB Output is correct
10 Correct 7 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 6 ms 512 KB Output is correct
7 Correct 7 ms 560 KB Output is correct
8 Correct 6 ms 512 KB Output is correct
9 Correct 7 ms 768 KB Output is correct
10 Correct 7 ms 512 KB Output is correct
11 Correct 11 ms 1280 KB Output is correct
12 Correct 20 ms 1152 KB Output is correct
13 Correct 56 ms 5540 KB Output is correct
14 Correct 89 ms 6996 KB Output is correct
15 Correct 126 ms 10576 KB Output is correct
16 Correct 98 ms 5224 KB Output is correct
17 Correct 107 ms 5224 KB Output is correct
18 Correct 151 ms 9448 KB Output is correct
19 Correct 223 ms 13856 KB Output is correct
20 Correct 217 ms 13844 KB Output is correct