이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |