Submission #2120345


Source Code Expand

N = gets.to_i
c = N.times.map { gets.split.map(&:to_i) }

ans = 0
ex = []

(0..(N-1)).to_a.combination(2) do |i, j|
  a = c[i]
  b = c[j]
  ex << i
  4.times do
    b.rotate!
    N.times do |n1|
      next if (ex + [i, j]).include?(n1)
      p1 = c[n1]
      4.times do
        p1.rotate!
        next if p1[0] != b[1] || p1[1] != a[0] || p1[2] != a[3] || p1[3] != b[2]
        N.times do |n2|
          next if (ex + [i, j, n1]).include?(n2)
          p2 = c[n2]
          4.times do
            p2.rotate!
            next if p2[0] !=b[2] || p2[1] != a[3] || p2[2] != a[2] || p2[3] != b[3]
            N.times do |n3|
              next if (ex + [i, j, n1, n2]).include?(n3)
              p3 = c[n3]
              4.times do
                p3.rotate!
                next if p3[0] != b[3] || p3[1] != a[2] || p3[2] != a[1] || p3[3] != b[0]
                N.times do |n4|
                  next if (ex + [i, j, n1, n2, n3]).include?(n4)
                  p4 = c[n4]
                  4.times do
                    p4.rotate!
                    next if p4[0] != b[0] || p4[1] != a[1] || p4[2] != a[0] || p4[3] != b[1]
                    ans += 1
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

p ans

Submission Info

Submission Time
Task E - Building Cubes with AtCoDeer
User kumojima
Language Ruby (2.3.3)
Score 0
Code Size 1337 Byte
Status TLE
Exec Time 4210 ms
Memory 39048 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 900
Status
AC × 3
AC × 5
TLE × 15
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 8 ms 2044 KB
0_001.txt AC 14 ms 2300 KB
0_002.txt AC 187 ms 2300 KB
1_003.txt TLE 4207 ms 2684 KB
1_004.txt TLE 4207 ms 4092 KB
1_005.txt TLE 4207 ms 2684 KB
1_006.txt TLE 4207 ms 2684 KB
1_007.txt TLE 4207 ms 2684 KB
1_008.txt TLE 4207 ms 2684 KB
1_009.txt TLE 4208 ms 8728 KB
1_010.txt TLE 4207 ms 14048 KB
1_011.txt TLE 4210 ms 34580 KB
1_012.txt AC 100 ms 9468 KB
1_013.txt TLE 4210 ms 37792 KB
1_014.txt AC 344 ms 16536 KB
1_015.txt TLE 4210 ms 37968 KB
1_016.txt TLE 4209 ms 24444 KB
1_017.txt TLE 4209 ms 38252 KB
1_018.txt TLE 4210 ms 37932 KB
1_019.txt TLE 4209 ms 39048 KB