#include <bits/stdc++.h>
using namespace std;
#define endl "\n";
bool subsolve(string jeden, string dwa){
if(jeden[0] == dwa[2] && jeden[1] == dwa[3]) return true;
if(jeden[2] == dwa[0] && jeden[3] == dwa[1]) return true;
if(jeden[1] == dwa[0] && jeden[3] == dwa[2]) return true;
if(jeden[0] == dwa[1] && jeden[2] == dwa[3]) return true;
return false;
}
void solve(){
int n, res = 0;
string napis;
cin >> n;
vector<string> lista(n, "");
for(int i = 0; i < n; i++){
cin >> napis;
lista[i] += napis;
cin >> napis;
lista[i] += napis;
}
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
res += subsolve(lista[i], lista[j]) ? 1 : 0;
}
}
cout << res << endl;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("input.txt", "r", stdin);
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
4 ms |
340 KB |
Output is correct |
7 |
Correct |
30 ms |
332 KB |
Output is correct |
8 |
Correct |
66 ms |
392 KB |
Output is correct |
9 |
Correct |
86 ms |
408 KB |
Output is correct |
10 |
Correct |
65 ms |
408 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1087 ms |
17264 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 |
1083 ms |
2128 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
30 ms |
332 KB |
Output is correct |
4 |
Correct |
66 ms |
392 KB |
Output is correct |
5 |
Correct |
86 ms |
408 KB |
Output is correct |
6 |
Correct |
65 ms |
408 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Execution timed out |
1087 ms |
17264 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |