Submission #589250

#TimeUsernameProblemLanguageResultExecution timeMemory
589250ignusCards (LMIO19_korteles)C++14
19 / 100
130 ms19788 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; //cout << fin << ' '; 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']; fin-=c[26*(26*(26*(t2-'A')+t1-'A')+t4-'A')+t3-'A']+c[26*(26*(26*(t3-'A')+t4-'A')+t1-'A')+t2-'A']; if(t1==t4&&t2==t3){ fin-=c[26*(26*(26*(t2-'A')+t1-'A')+t4-'A')+t3-'A']; } 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']++; c[26*(26*(26*(t1-'A')+t2-'A')+t3-'A')+t4-'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...