#include <bits/stdc++.h>
using namespace std;
#define endl "\n";
void solve(){
int n, res = 0;
string jeden, dwa;
cin >> n;
vector<string> lista(n, "");
for(int i = 0; i < n; i++){
cin >> jeden >> dwa;
lista[i] += jeden + dwa;
}
sort(lista.begin(), lista.end());
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
if(lista[i][0] == lista[j][2] && lista[i][1] == lista[j][3]) res++;
else if(lista[i][2] == lista[j][0] && lista[i][3] == lista[j][1]) res++;
else if(lista[i][1] == lista[j][0] && lista[i][3] == lista[j][2]) res++;
else if(lista[i][0] == lista[j][1] && lista[i][2] == lista[j][3]) res++;
else break;
}
}
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 |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
159 ms |
14548 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
18 ms |
1876 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |