답안 #518372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
518372 2022-01-23T15:02:07 Z drkarlicio2107 Cards (LMIO19_korteles) C++14
100 / 100
192 ms 10760 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]);
			xy[d][a][d]++; zq[b][a][b]++;
		}
		//cout << ans << endl;
		if (b==d){
			ans-=(yz[b][c][d]+qx[d][a][b]);
			yz[a][b][a]++; qx[c][b][c]++;
		}
		//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]++;
		xz [d][c][b][a]++; yq [b][a][d][c]++;
		xyzq [d][c][b][a]++;
		//cout << ans << endl;
	}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 588 KB Output is correct
3 Correct 1 ms 844 KB Output is correct
4 Correct 1 ms 1224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 588 KB Output is correct
3 Correct 1 ms 844 KB Output is correct
4 Correct 1 ms 1224 KB Output is correct
5 Correct 1 ms 308 KB Output is correct
6 Correct 3 ms 5036 KB Output is correct
7 Correct 2 ms 1844 KB Output is correct
8 Correct 5 ms 7760 KB Output is correct
9 Correct 4 ms 4816 KB Output is correct
10 Correct 4 ms 6480 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 192 ms 8084 KB Output is correct
2 Correct 166 ms 10760 KB Output is correct
3 Correct 140 ms 10696 KB Output is correct
4 Correct 146 ms 10732 KB Output is correct
5 Correct 150 ms 10636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 19 ms 7628 KB Output is correct
3 Correct 101 ms 7672 KB Output is correct
4 Correct 56 ms 7668 KB Output is correct
5 Correct 71 ms 7668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 3 ms 5036 KB Output is correct
3 Correct 2 ms 1844 KB Output is correct
4 Correct 5 ms 7760 KB Output is correct
5 Correct 4 ms 4816 KB Output is correct
6 Correct 4 ms 6480 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 1 ms 844 KB Output is correct
11 Correct 1 ms 1224 KB Output is correct
12 Correct 192 ms 8084 KB Output is correct
13 Correct 166 ms 10760 KB Output is correct
14 Correct 140 ms 10696 KB Output is correct
15 Correct 146 ms 10732 KB Output is correct
16 Correct 150 ms 10636 KB Output is correct
17 Correct 19 ms 7628 KB Output is correct
18 Correct 101 ms 7672 KB Output is correct
19 Correct 56 ms 7668 KB Output is correct
20 Correct 71 ms 7668 KB Output is correct
21 Correct 35 ms 8580 KB Output is correct
22 Correct 124 ms 10116 KB Output is correct
23 Correct 97 ms 9352 KB Output is correct
24 Correct 76 ms 9348 KB Output is correct