This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// 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";
}
# | 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... |