Submission #636147

#TimeUsernameProblemLanguageResultExecution timeMemory
636147KarolZCards (LMIO19_korteles)C++14
35 / 100
80 ms4920 KiB
#include<iostream> using namespace std; int ab[30][30]; //gora int cd[30][30]; //dol int ac[30][30]; //lewo int bd[30][30]; //prawo int abc[30][30][30]; //gora lewo int abd[30][30][30]; //gora prawo int acd[30][30][30]; //dol lewo int bcd[30][30][30]; //dol prawo int abcd[30][30][30][30]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,sum=0,v1,v2,v3,v4; string s1,s2; cin>>n; for(int i=0;i<n;i++){ cin>>s1>>s2; v1=s1[0]-'A'; v2=s1[1]-'A'; v3=s2[0]-'A'; v4=s2[1]-'A'; //cout<<sum<<' '; sum+=ab[v3][v4]; //cout<<sum<<' '; sum+=cd[v1][v2]; //cout<<sum<<' '; sum+=ac[v2][v4]; //cout<<sum<<' '; sum+=bd[v1][v3]; //cout<<sum<<' '; sum-=abcd[v3][v4][v1][v2]; //cout<<sum<<' '; if(v2==v3)sum-=abc[v2][v4][v4]; //cout<<sum<<' '; if(v1==v4)sum-=abd[v3][v1][v3]; //cout<<sum<<' '; if(v1==v4)sum-=acd[v2][v1][v2]; //cout<<sum<<' '; if(v2==v3)sum-=bcd[v1][v1][v3]; //cout<<sum<<' '; sum-=abcd[v2][v1][v4][v3]; //cout<<sum<<'\n'; abcd[v1][v2][v3][v4]=1; ab[v1][v2]++; cd[v3][v4]++; ac[v1][v3]++; bd[v2][v4]++; abc[v1][v2][v3]++; abd[v1][v2][v4]++; acd[v1][v3][v4]++; bcd[v2][v3][v4]++; } cout<<sum; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...