Submission #2114016
Source Code Expand
from bisect import bisect N = int(input()) C = [] M = {} for i in range(N): *c, = map(int, input().split()) c = tuple(min(c[j:] + c[:j] for j in range(1, 5))) C.append(c) M.setdefault(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(i, j, k): ci = C[i]; cj = C[j] R = {} for l in range(4): # [l] [l-1] # [l+k] [l+k+1] c = ci[l], ci[l-1], cj[(k-l+1)%4], cj[(k-l)%4] 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) - bisect(m, i) if c == cj: cnt -= 1 if cnt < R[c]: return 0 k = count(*c) r = 1 for p in range(cnt-R[c]+1, cnt+1): r *= p r *= k**cnt res *= r return res ans = 0 for i in range(N): for j in range(i+1, N): for k in range(4): ans += solve(i, j, k) print(ans)
Submission Info
Submission Time | |
---|---|
Task | E - Building Cubes with AtCoDeer |
User | yaketake08 |
Language | PyPy3 (2.4.0) |
Score | 0 |
Code Size | 1145 Byte |
Status | WA |
Exec Time | 4210 ms |
Memory | 76248 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 | AC | 168 ms | 38512 KB |
0_001.txt | AC | 170 ms | 38256 KB |
0_002.txt | AC | 171 ms | 38256 KB |
1_003.txt | WA | 3438 ms | 57820 KB |
1_004.txt | WA | 519 ms | 47196 KB |
1_005.txt | TLE | 4210 ms | 76248 KB |
1_006.txt | WA | 3338 ms | 69084 KB |
1_007.txt | TLE | 4209 ms | 70744 KB |
1_008.txt | TLE | 4129 ms | 69144 KB |
1_009.txt | WA | 3337 ms | 64220 KB |
1_010.txt | AC | 618 ms | 53596 KB |
1_011.txt | AC | 919 ms | 50652 KB |
1_012.txt | AC | 209 ms | 41564 KB |
1_013.txt | AC | 729 ms | 46996 KB |
1_014.txt | AC | 223 ms | 43484 KB |
1_015.txt | AC | 703 ms | 45020 KB |
1_016.txt | AC | 369 ms | 44636 KB |
1_017.txt | AC | 743 ms | 46556 KB |
1_018.txt | AC | 729 ms | 47068 KB |
1_019.txt | AC | 752 ms | 45148 KB |