Submission #2716903


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, c[666][4], z;
ll F(ll a, ll b, ll c, ll d) {
	return a << 30 | b << 20 | c << 10 | d;
}
map<ll, ll> g;
void A(ll x, ll v) {
	for (int i = 0; i < 4; i++) {
		g[x] += v;
		x = (x >> 10) | (x & 1023) << 30;
	}
}
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> c[i][j];
		}
		A(F(c[i][0], c[i][1], c[i][2], c[i][3]), 1);
	}
	for (int i = 0; i < n; i++) {
		A(F(c[i][0], c[i][1], c[i][2], c[i][3]), -1);
		for (int j = i + 1; j < n; j++) {
			A(F(c[j][0], c[j][1], c[j][2], c[j][3]), -1);
			for (int k = 0; k < 4; k++) {
				ll r = 1;
				for (int l = 0; l < 4; l++) {
					ll u = F(c[j][(k - l + 1) & 3], c[j][(k - l) & 3], c[i][(l + 1) & 3], c[i][l & 3]);
					r *= g[u];
					A(u, -1);
				}
				for (int l = 0; l < 4; l++) {
					ll u = F(c[j][(k - l + 1) & 3], c[j][(k - l) & 3], c[i][(l + 1) & 3], c[i][l & 3]);
					A(u, 1);
				}
				z += r;
			}
			A(F(c[j][0], c[j][1], c[j][2], c[j][3]), 1);
		}
	}
	cout << z << endl;
	return 0;
}

Submission Info

Submission Time
Task E - Building Cubes with AtCoDeer
User Factorio
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1105 Byte
Status TLE
Exec Time 4222 ms
Memory 319616 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 900
Status
AC × 3
AC × 15
TLE × 5
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt
Case Name Status Exec Time Memory
0_000.txt AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 59 ms 256 KB
1_004.txt AC 5 ms 256 KB
1_005.txt AC 87 ms 256 KB
1_006.txt AC 62 ms 256 KB
1_007.txt AC 150 ms 256 KB
1_008.txt AC 138 ms 256 KB
1_009.txt AC 419 ms 256 KB
1_010.txt AC 67 ms 256 KB
1_011.txt AC 956 ms 896 KB
1_012.txt AC 6 ms 640 KB
1_013.txt TLE 4219 ms 267776 KB
1_014.txt AC 21 ms 3456 KB
1_015.txt TLE 4222 ms 319104 KB
1_016.txt AC 930 ms 88064 KB
1_017.txt TLE 4222 ms 319616 KB
1_018.txt TLE 4222 ms 319104 KB
1_019.txt TLE 4222 ms 315136 KB