Submission #150053

#TimeUsernameProblemLanguageResultExecution timeMemory
150053강한친구 대한육군 (#200)FunctionCup Museum (FXCUP4_museum)C++17
27 / 100
81 ms7664 KiB
#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 (stderr)

museum.cpp: In function 'long long int cal(int)':
museum.cpp:13:16: warning: unused variable 'res' [-Wunused-variable]
  long long int res = x;
                ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...