// Autor: Adam Szymaszkiewicz
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
vector<vector<char>> v(n, vector<char>(4));
for (int i = 0; i < n; i++)
{
string a, b;
cin >> a >> b;
v[i][0] = a[0];
v[i][1] = a[1];
v[i][2] = b[0];
v[i][3] = b[1];
}
// for (int i = 0; i < n; i++)
// {
// for (int j = 0; j < 4; j++)
// cout << v[i][j] << " ";
// cout << "\n";
// }
int wyn = 0;
for (int i = 0; i < n; i++)
for (int j = i+1; j < n; j++)
{
// cout << i << " " << j << "\n";
if ((v[i][0] == v[j][2] && v[i][1] == v[j][3])\
|| (v[i][2] == v[j][0] && v[i][3] == v[j][1])\
|| (v[i][0] == v[j][1] && v[i][2] == v[j][3])\
|| (v[i][1] == v[j][0] && v[i][3] == v[j][2]))
wyn++;
}
cout << wyn << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
244 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
244 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
8 ms |
340 KB |
Output is correct |
8 |
Correct |
11 ms |
468 KB |
Output is correct |
9 |
Correct |
23 ms |
456 KB |
Output is correct |
10 |
Correct |
14 ms |
472 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1074 ms |
27996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
1089 ms |
3284 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
8 ms |
340 KB |
Output is correct |
4 |
Correct |
11 ms |
468 KB |
Output is correct |
5 |
Correct |
23 ms |
456 KB |
Output is correct |
6 |
Correct |
14 ms |
472 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
244 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Execution timed out |
1074 ms |
27996 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |