# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
150053 | 2019-09-01T07:37:55 Z | 강한친구 대한육군(#3592, pichulia) | 함수컵 박물관 (FXCUP4_museum) | C++17 | 81 ms | 7664 KB |
#include "museum.h" #include<vector> #include<algorithm> using namespace std; int a[102]; int b[102]; int c[102]; int ab[102][102]; int bc[102][102]; int ca[102][102]; int abc[102][102][102]; long long cal(int x) { long long int res = x; return x * (x - 1) / 2; } long long CountSimilarPairs(std::vector<int> x, std::vector<int> y, std::vector<int> z) { int n = x.size(); long long int res = 0; int i, j, k; for (i = 0; i < n; i++) { a[x[i]]++; b[y[i]]++; c[z[i]]++; ab[x[i]][y[i]]++; bc[y[i]][z[i]]++; ca[z[i]][x[i]]++; abc[x[i]][y[i]][z[i]]++; } for (i = 1; i <= 100; i++) { res += cal(a[i]); res += cal(b[i]); res += cal(c[i]); for (j = 1; j <= 100; j++) { res -= cal(ab[i][j]); res -= cal(bc[i][j]); res -= cal(ca[i][j]); for (k = 1; k <= 100; k++) { res += cal(abc[i][j][k]); } } } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 384 KB | Output is correct |
2 | Correct | 8 ms | 384 KB | Output is correct |
3 | Correct | 8 ms | 512 KB | Output is correct |
4 | Correct | 9 ms | 640 KB | Output is correct |
5 | Correct | 9 ms | 1792 KB | Output is correct |
6 | Correct | 8 ms | 2304 KB | Output is correct |
7 | Correct | 8 ms | 2944 KB | Output is correct |
8 | Correct | 9 ms | 512 KB | Output is correct |
9 | Correct | 9 ms | 4096 KB | Output is correct |
10 | Correct | 10 ms | 3968 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 384 KB | Output is correct |
2 | Correct | 8 ms | 384 KB | Output is correct |
3 | Correct | 8 ms | 512 KB | Output is correct |
4 | Correct | 9 ms | 640 KB | Output is correct |
5 | Correct | 9 ms | 1792 KB | Output is correct |
6 | Correct | 8 ms | 2304 KB | Output is correct |
7 | Correct | 8 ms | 2944 KB | Output is correct |
8 | Correct | 9 ms | 512 KB | Output is correct |
9 | Correct | 9 ms | 4096 KB | Output is correct |
10 | Correct | 10 ms | 3968 KB | Output is correct |
11 | Correct | 16 ms | 4736 KB | Output is correct |
12 | Correct | 21 ms | 1152 KB | Output is correct |
13 | Correct | 34 ms | 5492 KB | Output is correct |
14 | Correct | 53 ms | 6636 KB | Output is correct |
15 | Correct | 61 ms | 7664 KB | Output is correct |
16 | Incorrect | 81 ms | 5228 KB | Output isn't correct |
17 | Halted | 0 ms | 0 KB | - |