This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define s second
#define f first
vector<char> find(vector<char> v){
vector<char> k(4,' ');
k[3-1] = v[1]; k[4-1] = v[2];
k[0] = v[3]; k[2-1] = v[4];
if(k[0] == v[2] && k[2] == v[4] && k[1] == v[1] && k[3] == v[3]) return k;
return {};
}
bool check(vector<char> a, vector<char> b){
if(a[1] == b[3] && a[2] == b[4]) return true;
if(a[1] == b[2] && a[3] == b[4]) return true;
if(a[2] == b[4] && a[1] == b[3]) return true;
if(a[3] == b[1] && a[4] == b[2]) return true;
return false;
}
signed main(){
int n; cin>>n;
map<pair<char,char>,int> m12,m13,m34,m24;
map<vector<char>,int> m1234,m123, m124, m134, m234;
int ans = 0;
vector<vector<char>> v;
for(int i = 0; i<n; i++){
// 100% CHECKED
vector<char> v1(5); cin>>v1[1]>>v1[2]>>v1[3]>>v1[4];
v.push_back(v1);
}
for(int i = 0; i<n; i++){
for(int j = i+1; j<n; j++){
if(check(v[i],v[j])) ans++;
}
}
cout<<ans<<endl;
}
# | 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... |