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>
#define int long long
#define endl '\n'
using namespace std;
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin>>n;
map<string,int>mp;
int ans=0;
for(int i=0;i<n;i++){
string chr[2][2];
for(int w=0;w<2;w++){
for(int j=0;j<2;j++){
char c;
string f;
cin>>c;
f+=c;
chr[w][j]=f;
}
}
for(int w=1;w<(1<<4);w++){
string g,G;
for(int j=0;j<4;j++){
if((1<<j)&w){
if(j==2)G+=chr[0][0]+chr[0][1];
if(j==3)G+=chr[0][1]+chr[1][1];
if(j==0)G+=chr[1][0]+chr[1][1];
if(j==1)G+=chr[0][0]+chr[1][0];
}else G+="..";
}
ans+=mp[G]*(__builtin_popcount(w)%2?1:-1);
}
for(int w=1;w<(1<<4);w++){
string g,G;
for(int j=0;j<4;j++){
if((1<<j)&w){
if(j==0)g+=chr[0][0]+chr[0][1];
if(j==1)g+=chr[0][1]+chr[1][1];
if(j==2)g+=chr[1][0]+chr[1][1];
if(j==3)g+=chr[0][0]+chr[1][0];
}else g+="..";
}
mp[g]++;
}
}
cout<<ans;
}
# | 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... |