답안 #518359

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
518359 2022-01-23T14:20:44 Z drkarlicio2107 Cards (LMIO19_korteles) C++14
0 / 100
141 ms 5808 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 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];
		//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];
		}
		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]++;
		xyzq [b][c][d][a]++;
		//cout << ans << endl;
	}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 464 KB Output is correct
3 Incorrect 1 ms 592 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 464 KB Output is correct
3 Incorrect 1 ms 592 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 141 ms 5808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Incorrect 17 ms 3448 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 0 ms 464 KB Output is correct
4 Incorrect 1 ms 592 KB Output isn't correct
5 Halted 0 ms 0 KB -