Submission #589245

#TimeUsernameProblemLanguageResultExecution timeMemory
589245ignusCards (LMIO19_korteles)C++14
0 / 100
127 ms20784 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int a[4][676]; int c[4556976]; long long fin = 0; for(int i = 0; i < 676; i++){ for(int j = 0; j < 4; j++)a[j][i]=0; } for(int i = 0; i < 4556976; i++){ c[i]=0; } for(int i = 0; i < n; i++){ char t1, t2, t3, t4; cin >> t1 >> t2 >> t3 >> t4; a[0][26*(t1-'A')+t2-'A']++; a[1][26*(t3-'A')+t4-'A']++; a[2][26*(t1-'A')+t3-'A']++; a[3][26*(t2-'A')+t4-'A']++; fin+=a[0][26*(t3-'A')+t4-'A']+a[1][26*(t1-'A')+t2-'A']+a[2][26*(t2-'A')+t4-'A']+a[3][26*(t1-'A')+t3-'A']; c[26*(26*(26*(t1-'A')+t2-'A')+t3-'A')+t4-'A']++; fin-=c[26*(26*(26*(t2-'A')+t1-'A')+t4-'A')+t3-'A']+26*(26*(26*(t3-'A')+t4-'A')+t1-'A')+t2-'A'; if(26*(26*(26*(t2-'A')+t1-'A')+t4-'A')+t3-'A'==26*(26*(26*(t3-'A')+t4-'A')+t1-'A')+t2-'A'){ fin-=c[26*(26*(26*(t2-'A')+t1-'A')+t4-'A')+t3-'A']; } } cout << fin; 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...