Submission #287844

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2878442020-09-01 04:15:02nandonathanielCards (LMIO19_korteles)C++14
100 / 100
63 ms4860 KiB
#include<bits/stdc++.h>
using namespace std;
const int MAXEMPAT=457000,MAXDUA=680;
int kiri[MAXDUA],kanan[MAXDUA],atas[MAXDUA],bawah[MAXDUA],cnt[MAXEMPAT];
int dua(int x,int y){
return 26*x+y;
}
int empat(int u,int v,int x,int y){
return 26*26*26*u+26*26*v+26*x+y;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n;
long long ans=0;
char a,b,c,d;
cin >> n;
for(int i=1;i<=n;i++){
cin >> a >> b >> c >> d;
cnt[empat(a-'A',b-'A',c-'A',d-'A')]++;
kiri[dua(a-'A',c-'A')]++;
kanan[dua(b-'A',d-'A')]++;
atas[dua(a-'A',b-'A')]++;
bawah[dua(c-'A',d-'A')]++;
}
for(int i=0;i<676;i++){
ans+=1LL*kiri[i]*kanan[i];
ans+=1LL*atas[i]*bawah[i];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...