Submission #588898

#TimeUsernameProblemLanguageResultExecution timeMemory
588898PiokemonCards (LMIO19_korteles)C++17
0 / 100
104 ms5112 KiB
#include <bits/stdc++.h> using namespace std; int wyst[27][27][27][27]; //26 = nie obchodzi mnie co to za litera int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,ind1,ind2,ind3,ind4; long long int odp; string a,b; cin >> n; odp = 0; for (int x=0;x<n;x++){ cin >> a >> b; for (int mask = 0;mask<(1<<4);mask++){ ind1 = 26; ind2 = 26; ind3 = 26; ind4 = 26; if (mask&1){ ind1 = (int)a[0] - 65; } if (mask&2){ ind2 = (int)a[1] - 65; } if (mask&4){ ind3 = (int)b[0] - 65; } if (mask&8){ ind4 = (int)b[1] - 65; } wyst[ind1][ind2][ind3][ind4] += 1; } } for (int x=0;x<26;x++){ for (int y=0;y<=x;y++){ odp += wyst[26][x][26][y] * wyst[x][26][y][26] - wyst[x][x][y][y] * wyst[x][x][y][y]; odp += wyst[26][26][x][y] * wyst[x][y][26][26] - wyst[x][y][y][26] * wyst[x][y][y][26] - wyst[26][y][y][x] * wyst[26][y][y][x] + wyst[x][y][y][x] * wyst[x][y][y][x]; } odp += max(wyst[x][x][x][x] * (wyst[x][x][x][x]-1),0) / 2; } cout << odp << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...