Submission #148909

# Submission time Handle Problem Language Result Execution time Memory
148909 2019-09-01T05:21:41 Z Avengers(#3759, Blagojce) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
96 ms 13416 KB
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x),end(x)

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
ll const inf = 1e9;
ll const mod = 1e9 + 7;
ld const eps = 1e-9;
#include "museum.h"
ll _1[101];
ll _2[101];
ll _3[101];
ll _12[101][101];
ll _13[101][101];
ll _23[101][101];
ll cnt[101][101][101];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int N = B.size();
	ll ans = 0;

	fr(i, 0, N){
                if(i > 0){
                        ans += _1[B[i]] + _2[T[i]] + _3[G[i]] - _12[B[i]][T[i]] - _13[B[i]][G[i]] - _23[T[i]][G[i]] + cnt[B[i]][T[i]][G[i]];
                }
                _1[B[i]] ++;
                _2[T[i]] ++;
                _3[G[i]] ++;
                _12[B[i]][T[i]] ++;
                _13[B[i]][G[i]] ++;
                _23[T[i]][G[i]] ++;
                cnt[B[i]][T[i]][G[i]] ++;
	}

	return ans;
}
/*

int main()
{
    cout << CountSimilarPairs({1, 2, 3, 4, 1}, {1, 2, 1, 2, 1}, {1, 1, 2, 2, 3}) << endl;
    return 0;
}
*/
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 512 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 6 ms 768 KB Output is correct
5 Correct 6 ms 2048 KB Output is correct
6 Correct 8 ms 2944 KB Output is correct
7 Correct 8 ms 3712 KB Output is correct
8 Correct 6 ms 640 KB Output is correct
9 Correct 9 ms 5760 KB Output is correct
10 Correct 10 ms 5760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 512 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 6 ms 768 KB Output is correct
5 Correct 6 ms 2048 KB Output is correct
6 Correct 8 ms 2944 KB Output is correct
7 Correct 8 ms 3712 KB Output is correct
8 Correct 6 ms 640 KB Output is correct
9 Correct 9 ms 5760 KB Output is correct
10 Correct 10 ms 5760 KB Output is correct
11 Correct 13 ms 8320 KB Output is correct
12 Correct 16 ms 1152 KB Output is correct
13 Correct 33 ms 8820 KB Output is correct
14 Correct 45 ms 10604 KB Output is correct
15 Correct 64 ms 11632 KB Output is correct
16 Correct 73 ms 5092 KB Output is correct
17 Correct 75 ms 5352 KB Output is correct
18 Correct 84 ms 7528 KB Output is correct
19 Correct 96 ms 13416 KB Output is correct
20 Correct 93 ms 13416 KB Output is correct