Submission #636144

# Submission time Handle Problem Language Result Execution time Memory
636144 2022-08-28T10:34:05 Z KarolZ Cards (LMIO19_korteles) C++14
19 / 100
74 ms 4920 KB
#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];
        sum+=cd[v1][v2];
        sum+=ac[v2][v4];
        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(v2==v3)sum-=abd[v2][v1][v1];
        //cout<<sum<<' ';
        if(v3==v4)sum-=acd[v2][v3][v3];
        //cout<<sum<<' ';
        if(v3==v4)sum-=bcd[v1][v3][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 time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Incorrect 1 ms 836 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Incorrect 1 ms 836 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 4708 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 13 ms 3464 KB Output is correct
3 Correct 54 ms 4920 KB Output is correct
4 Correct 32 ms 4176 KB Output is correct
5 Correct 25 ms 4160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Incorrect 1 ms 836 KB Output isn't correct
6 Halted 0 ms 0 KB -