Submission #518369

# Submission time Handle Problem Language Result Execution time Memory
518369 2022-01-23T14:48:03 Z drkarlicio2107 Cards (LMIO19_korteles) C++14
19 / 100
159 ms 9712 KB
#include <bits/stdc++.h>
using namespace std;
int x [30][30]; int y [30][30]; int z [30][30]; int q [30][30];
int xy [30][30][30]; int yz [30][30][30]; int zq [30][30][30]; int qx [30][30][30]; int xz [30][30][30][30]; int yq [30][30][30][30];
int xyzq [30][30][30][30];
int main(){
	int n; cin >> n; long long int ans=0;
	for (int i=0; i<n; i++){
		char a1,b1,c1,d1; cin >> a1 >> b1 >> c1 >> d1;
		int a=a1-'A', b=b1-'A', c=d1-'A', d=c1-'A';
		ans+=x[a][b]+y[b][c]+z[c][d]+q[d][a];
		ans-=(xz [a][b][c][d]+yq[a][b][c][d]);
		//cout << ans << " " << zq[a][c][d] << endl;
		if (a==c){
			ans-=(xy[a][b][c]+zq[a][d][c]);
		}
		//cout << ans << endl;
		if (b==d){
			ans-=(yz[b][c][d]+qx[d][a][b]);
		}
		//cout << ans << endl;
		if (a==c && b==d){
			ans+=xyzq [a][b][c][d]*3;
		}
		x[d][c]++; y [a][d]++; z [b][a]++; q [c][b]++;
		xy[d][a][d]++; zq[b][a][b]++;
		yz[a][b][a]++; qx[c][b][c]++;
		xz [d][c][b][a]++; yq [b][a][d][c]++;
		xyzq [d][c][b][a]++;
		//cout << ans << endl;
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 588 KB Output is correct
3 Incorrect 1 ms 844 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 588 KB Output is correct
3 Incorrect 1 ms 844 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 159 ms 8084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 24 ms 8060 KB Output is correct
3 Correct 121 ms 9712 KB Output is correct
4 Correct 70 ms 9036 KB Output is correct
5 Correct 67 ms 9040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 588 KB Output is correct
4 Incorrect 1 ms 844 KB Output isn't correct
5 Halted 0 ms 0 KB -