Submission #151159

#TimeUsernameProblemLanguageResultExecution timeMemory
151159kuroniFunctionCup Museum (FXCUP4_museum)C++17
100 / 100
94 ms11316 KiB
#include "museum.h" #include <bits/stdc++.h> using namespace std; const int MX = 105; int n, cnt[MX][MX][MX]; int &get(int a, int b, int c, int msk) { if (!(msk & 1)) a = 0; if (!(msk & 2)) b = 0; if (!(msk & 4)) c = 0; return cnt[a][b][c]; } long long CountSimilarPairs(vector<int> b, vector<int> t, vector<int> g) { int n = b.size(); long long ans = 0; for (int i = 0; i < n; i++) for (int msk = 1; msk < 8; msk++) ans += ((__builtin_popcount(msk) & 1) ? 1 : -1) * (get(b[i], t[i], g[i], msk)++); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...