#include <bits/stdc++.h>
using namespace std;
int N,rj;
string a,b;
string karte[456976];
int main()
{
cin>>N;
for(int i=0;i<N;i++)
{
cin>>a>>b;
karte[i]=a+b;
}
for(int i=0;i<N;i++)
{
for(int j=i+1;j<N;j++)
{
string s=karte[i];
string t=karte[j];
string da="", db="", dc="", dd="";
for(int i=0;i<4;i++)
{
if(i%2==0)
{
da+=s[i];
dc+=t[i];
}
else
{
db+=s[i];
dd+=t[i];
}
}
if(s.substr(2,3)==t.substr(0,2))
{
rj++;
}
else if(s.substr(0,2)==t.substr(2,3))
{
rj++;
}
else if(da==dd)
{
rj++;
}
else if(db==dc)
{
rj++;
}
}
}
cout<<rj;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
14540 KB |
Output is correct |
2 |
Correct |
8 ms |
14600 KB |
Output is correct |
3 |
Correct |
8 ms |
14540 KB |
Output is correct |
4 |
Correct |
8 ms |
14540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
14540 KB |
Output is correct |
2 |
Correct |
8 ms |
14600 KB |
Output is correct |
3 |
Correct |
8 ms |
14540 KB |
Output is correct |
4 |
Correct |
8 ms |
14540 KB |
Output is correct |
5 |
Correct |
10 ms |
14592 KB |
Output is correct |
6 |
Correct |
31 ms |
14540 KB |
Output is correct |
7 |
Correct |
174 ms |
14588 KB |
Output is correct |
8 |
Correct |
391 ms |
14592 KB |
Output is correct |
9 |
Correct |
414 ms |
14540 KB |
Output is correct |
10 |
Correct |
440 ms |
14588 KB |
Output is correct |
11 |
Correct |
8 ms |
14540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1046 ms |
17248 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
14540 KB |
Output is correct |
2 |
Execution timed out |
1056 ms |
14828 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
14592 KB |
Output is correct |
2 |
Correct |
31 ms |
14540 KB |
Output is correct |
3 |
Correct |
174 ms |
14588 KB |
Output is correct |
4 |
Correct |
391 ms |
14592 KB |
Output is correct |
5 |
Correct |
414 ms |
14540 KB |
Output is correct |
6 |
Correct |
440 ms |
14588 KB |
Output is correct |
7 |
Correct |
8 ms |
14540 KB |
Output is correct |
8 |
Correct |
7 ms |
14540 KB |
Output is correct |
9 |
Correct |
8 ms |
14600 KB |
Output is correct |
10 |
Correct |
8 ms |
14540 KB |
Output is correct |
11 |
Correct |
8 ms |
14540 KB |
Output is correct |
12 |
Execution timed out |
1046 ms |
17248 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |