# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
636081 |
2022-08-27T23:40:49 Z |
KarolZ |
Cards (LMIO19_korteles) |
C++14 |
|
1000 ms |
31032 KB |
#include<iostream>
#include<map>
#include<vector>
using namespace std;
map< pair<char,char>,int >mn; //gora
map< pair<char,char>,int >ms; //dol
map< pair<char,char>,int >mw; //lewo
map< pair<char,char>,int >me; //prawo
map< pair< pair<int,int>,pair<int,int> >,int >m;
vector< pair< pair<char,char>,pair<char,char> > >v;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,sum=0;
string s1,s2;
char v1,v2,v3,v4;
cin>>n;
for(int i=0;i<n;i++){
cin>>s1>>s2;
v1=s1[0];
v2=s1[1];
v3=s2[0];
v4=s2[1];
m[{{v1,v2},{v3,v4}}]=1;
mn[{v1,v2}]++;
ms[{v3,v4}]++;
mw[{v1,v3}]++;
me[{v2,v4}]++;
v.push_back({{v1,v2},{v3,v4}});
}
for(int i=0;i<n;i++){
v1=v[i].first.first;
v2=v[i].first.second;
v3=v[i].second.first;
v4=v[i].second.second;
sum+=mn[{v3,v4}];
sum+=mw[{v2,v4}];
sum+=ms[{v1,v2}];
sum+=me[{v1,v3}];
if(v1==v2&&v2==v3&&v3==v4){
sum-=4;
continue;
}
if(m[{{v3,v4},{v1,v2}}]){
sum--;
}
if(m[{{v2,v4},{v1,v3}}]){
sum--;
}
if(m[{{v3,v4},{v1,v2}}]&&m[{{v2,v4},{v1,v3}}])sum--;
}
cout<<sum/2;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
31032 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
143 ms |
8732 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |