Submission #477349

# Submission time Handle Problem Language Result Execution time Memory
477349 2021-10-01T18:06:16 Z BThero Cards (LMIO19_korteles) C++17
36 / 100
1000 ms 7324 KB
#include <bits/stdc++.h>

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

using namespace std;

typedef long long ll;

const int MAXN = (int)5e5 + 5;

array<int, 4> arr[MAXN];
int n;

int encode(char a, char b) {
	return (a - 'A') * 26 + (b - 'A');
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n;

	for (int i = 0; i < n; i++) {
		string x, y;
		cin >> x >> y;
		arr[i][0] = encode(x[0], x[1]);
		arr[i][1] = encode(x[0], y[0]);
		arr[i][2] = encode(x[1], y[1]);
		arr[i][3] = encode(y[0], y[1]);
	}

	ll ans = 0;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < i; j++) {
			bool ok = 0;

			for (int k = 0; k < 4; k++) {
				ok |= (arr[i][k] == arr[j][k]);
			}

			if (ok) ans++;
		}

		reverse(all(arr[i]));
	}

	cout << ans << '\n';
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 6 ms 336 KB Output is correct
8 Correct 14 ms 332 KB Output is correct
9 Correct 17 ms 360 KB Output is correct
10 Correct 19 ms 332 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 7324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Execution timed out 1087 ms 1048 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 6 ms 336 KB Output is correct
4 Correct 14 ms 332 KB Output is correct
5 Correct 17 ms 360 KB Output is correct
6 Correct 19 ms 332 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Execution timed out 1094 ms 7324 KB Time limit exceeded
13 Halted 0 ms 0 KB -