Submission #2114116
Source Code Expand
from collections import deque N = int(input()) C = [] M = {} for i in range(N): *c, = 0, 0, 0, 0 #map(int, input().split()) c = tuple(min(c[j:] + c[:j] for j in range(1, 5))) C.append(c) if c not in M: M[c] = deque([i]) else: M[c].append(i) def count(p, q, r, s): if p == q == r == s: return 4 if p == r and q == s: return 2 return 1 def solve(ci, cj, k): R = {} for l in range(4): # [l] [l-1] # [l+k] [l+k+1] c = ci[l], ci[l-1], cj[k-l], cj[k-l-1] c = tuple(min(c[j:] + c[:j] for j in range(1, 5))) if c not in M: return 0 R[c] = R.get(c, 0) + 1 res = 1 for c in R: m = M[c] cnt = len(m) if c == cj: cnt -= 1 if cnt < R[c]: return 0 k = count(*c) for p in range(cnt-R[c]+1, cnt+1): res *= p * k return res ans = 0 for i in range(N): ci = C[i] q = M[ci]; q.popleft() if not q: del M[ci] for j in range(i+1, N): cj = C[j] for k in range(4): ans += solve(ci, cj, k) print(ans)
Submission Info
Submission Time | |
---|---|
Task | E - Building Cubes with AtCoDeer |
User | yaketake08 |
Language | PyPy3 (2.4.0) |
Score | 0 |
Code Size | 1211 Byte |
Status | WA |
Exec Time | 3071 ms |
Memory | 54456 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 900 | ||||||||
Status |
|
|
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 | WA | 171 ms | 38384 KB |
0_001.txt | WA | 183 ms | 39280 KB |
0_002.txt | AC | 169 ms | 38256 KB |
1_003.txt | AC | 3071 ms | 54108 KB |
1_004.txt | AC | 478 ms | 46812 KB |
1_005.txt | WA | 2963 ms | 52316 KB |
1_006.txt | WA | 2218 ms | 51804 KB |
1_007.txt | WA | 2954 ms | 52316 KB |
1_008.txt | WA | 2737 ms | 52316 KB |
1_009.txt | WA | 3027 ms | 52316 KB |
1_010.txt | WA | 675 ms | 47836 KB |
1_011.txt | WA | 2957 ms | 53468 KB |
1_012.txt | WA | 273 ms | 45276 KB |
1_013.txt | WA | 2973 ms | 52316 KB |
1_014.txt | WA | 307 ms | 46172 KB |
1_015.txt | WA | 2952 ms | 54456 KB |
1_016.txt | WA | 1018 ms | 49244 KB |
1_017.txt | WA | 2925 ms | 52316 KB |
1_018.txt | WA | 2916 ms | 52316 KB |
1_019.txt | WA | 2996 ms | 53588 KB |