#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 |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 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 |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
12 ms |
340 KB |
Output is correct |
8 |
Correct |
20 ms |
340 KB |
Output is correct |
9 |
Correct |
26 ms |
348 KB |
Output is correct |
10 |
Correct |
19 ms |
368 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1034 ms |
3548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Execution timed out |
1080 ms |
724 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
12 ms |
340 KB |
Output is correct |
4 |
Correct |
20 ms |
340 KB |
Output is correct |
5 |
Correct |
26 ms |
348 KB |
Output is correct |
6 |
Correct |
19 ms |
368 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Execution timed out |
1034 ms |
3548 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |