#include <iostream>
#include <vector>
using namespace std;
int n = 0;
unsigned long long wyn = 0;
char wczytany_znak;
struct Karta {
char L_G;
char P_G;
char L_D;
char P_D;
};
vector<Karta> karty;
bool czy_mozna_ulozyc(Karta k_1, Karta k_2)
{
if (k_1.P_G == k_2.L_G && k_1.P_D == k_2.L_D)
{
return true;
}
if (k_1.L_G == k_2.P_G && k_1.L_D == k_2.P_D)
{
return true;
}
if (k_1.L_G == k_2.L_D && k_1.P_G == k_2.P_D)
{
return true;
}
if (k_1.L_D == k_2.L_G && k_1.P_D == k_2.P_G)
{
return true;
}
return false;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 0; i < n; ++i)
{
karty.push_back({});
cin >> karty[i].L_G >> karty[i].P_G >> karty[i].L_D >> karty[i].P_D;
}
for (int i = 0; i < n; ++i)
{
for (int j = i+1; j < n; ++j)
{
if (czy_mozna_ulozyc(karty[i],karty[j]) == true)
{
wyn++;
}
}
}
cout << wyn;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
324 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
7 ms |
332 KB |
Output is correct |
8 |
Correct |
10 ms |
364 KB |
Output is correct |
9 |
Correct |
21 ms |
340 KB |
Output is correct |
10 |
Correct |
13 ms |
468 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1077 ms |
4804 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 |
1065 ms |
980 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 |
332 KB |
Output is correct |
3 |
Correct |
7 ms |
332 KB |
Output is correct |
4 |
Correct |
10 ms |
364 KB |
Output is correct |
5 |
Correct |
21 ms |
340 KB |
Output is correct |
6 |
Correct |
13 ms |
468 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
324 KB |
Output is correct |
12 |
Execution timed out |
1077 ms |
4804 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |