# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
287844 | nandonathaniel | Cards (LMIO19_korteles) | C++14 | 63 ms | 4860 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |