답안 #591273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
591273 2022-07-07T08:08:23 Z OmnitronX Cards (LMIO19_korteles) C++14
19 / 100
56 ms 3432 KB
#include <iostream>

using namespace std;
using num = int;

num gora[26][26];
num dol[26][26];
num lewo[26][26];
num prawo[26][26];
bool tab[26][26][26][26];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	num n;
	num r = 0;
	cin >> n;
	for (num i = 0; i < n; ++i)
	{
		string s1;
		string s2;
		cin >> s1 >> s2;
		num a = s1[0] - 65;
		num b = s1[1] - 65;
		num c = s2[0] - 65;
		num d = s2[1] - 65;
		++gora [a][b];
		++dol  [c][d];

		++prawo[b][d];
		++lewo [a][c];
		tab[a][b]
		   [c][d] = true;
		if (tab[c][d]
			   [a][b])
		{
			++r;
		}
		if (tab[b][a]
			   [d][c])
		{
			++r;
		}
		if (a == d)
		{
			for (num j = 0; j < 26; ++j)
			{
				if (tab[b][j]
					   [a][b])
				{
					++r;
				}
			}
			for (num j = 0; j < 26; ++j)
			{
				if (tab[c][a]
					   [j][c])
				{
					++r;
				}
			}
		}
		else if (b == c)
		{
			for (num j = 0; j < 26; ++j)
			{
				if (tab[b][d]
					   [d][j])
				{
					++r;
				}
			}
			for (num j = 0; j < 26; ++j)
			{
				if (tab[j][a]
					   [a][b])
				{
					++r;
				}
			}
		}
		if (a == d && b == c)
		{
			if (tab[b][a]
				   [a][b])
			{
				--r;
			}
		}
		if (a == d && b == c && a == b)
		{
			--r;
		}
	}
	num suma = 0;
	for (num i = 0; i < 26; ++i)
	{
		for (num j = 0; j < 26; ++j)
		{
			suma += gora[i][j] * dol[i][j];
		}
	}
	for (num i = 0; i < 26; ++i)
	{
		for (num j = 0; j < 26; ++j)
		{
			suma += prawo[i][j] * lewo[i][j];
		}
	}
	cout << suma - r;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 56 ms 3432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 6 ms 984 KB Output is correct
3 Correct 36 ms 2508 KB Output is correct
4 Correct 25 ms 1784 KB Output is correct
5 Correct 22 ms 1780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Halted 0 ms 0 KB -