#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()
{
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 |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
3 ms |
320 KB |
Output is correct |
7 |
Correct |
10 ms |
212 KB |
Output is correct |
8 |
Correct |
16 ms |
344 KB |
Output is correct |
9 |
Correct |
26 ms |
320 KB |
Output is correct |
10 |
Correct |
18 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
4648 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1083 ms |
724 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Correct |
3 ms |
320 KB |
Output is correct |
3 |
Correct |
10 ms |
212 KB |
Output is correct |
4 |
Correct |
16 ms |
344 KB |
Output is correct |
5 |
Correct |
26 ms |
320 KB |
Output is correct |
6 |
Correct |
18 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
308 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Execution timed out |
1084 ms |
4648 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |