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 MAXN = 500000;
char karty[2][2][MAXN];
bool check(int i , int j)
{
if(karty[1][0][i] == karty[0][0][j] && karty[1][1][i] == karty[0][1][j]) return 1;
if(karty[1][0][j] == karty[0][0][i] && karty[1][1][j] == karty[0][1][i]) return 1;
if(karty[0][1][i] == karty[0][0][j] && karty[1][1][i] == karty[1][0][j]) return 1;
if(karty[0][1][j] == karty[0][0][i] && karty[1][1][j] == karty[1][0][i]) return 1;
return 0;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
string pom;
for(int i=0;i<N;i++)
{
cin >> pom;
karty[0][0][i]=pom[0];
karty[0][1][i]=pom[1];
cin >> pom;
karty[1][0][i]=pom[0];
karty[1][1][i]=pom[1];
}
long long int wynik=0;
for(int i=0;i<N-1;i++)
{
for(int j=i+1;j<N;j++)
{
if(check(i,j))
{
wynik++;
}
}
}
cout << wynik;
return 0;
}
# | 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... |