Submission #3974675
Source Code Expand
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return list(ns()) def ni(): return int(stdin.readline()) def nf(): return float(stdin.readline()) from itertools import permutations def check(x: list): for i in range(3): for j in range(5): if x[i][j] < x[i+1][j] < x[i+2][j] or x[i][j] > x[i+1][j] > x[i+2][j]: return False for i in range(5): for j in range(3): if x[i][j] < x[i][j+1] < x[i][j+2] or x[i][j] > x[i][j+1] > x[i][j+2]: return False return True hole = [] x = [list(li()) for _ in range(5)] st = ([i for i in range(1,26)]) for i, xi in enumerate(x): for j, xij in enumerate(xi): if xij in st: st.remove(xij) else: hole.append((i,j)) lacked = list(st) cands = list(permutations(lacked)) ans = 0 for ci in cands: for cij, (holei, holej) in zip(ci, hole): x[holei][holej] = cij ans += check(x) print(ans)
Submission Info
Submission Time | |
---|---|
Task | D - 25個の整数 |
User | polarbear08 |
Language | Python (3.4.3) |
Score | 30 |
Code Size | 1336 Byte |
Status | RE |
Exec Time | 6107 ms |
Memory | 8052 KB |
Judge Result
Set Name | Sample | Subtask1 | Subtask2 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 30 / 30 | 0 / 70 | ||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt |
Subtask1 | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, test-1-01.txt, test-1-02.txt, test-1-03.txt, test-1-04.txt, test-1-05.txt, test-1-06.txt, test-1-07.txt, test-1-08.txt, test-1-09.txt, test-1-10.txt, test-1-11.txt, test-1-12.txt, test-1-13.txt, test-1-14.txt, test-1-15.txt |
Subtask2 | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, test-1-01.txt, test-1-02.txt, test-1-03.txt, test-1-04.txt, test-1-05.txt, test-1-06.txt, test-1-07.txt, test-1-08.txt, test-1-09.txt, test-1-10.txt, test-1-11.txt, test-1-12.txt, test-1-13.txt, test-1-14.txt, test-1-15.txt, test-2-01.txt, test-2-02.txt, test-2-03.txt, test-2-04.txt, test-2-05.txt, test-2-06.txt, test-2-07.txt, test-2-08.txt, test-2-09.txt, test-2-10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample-01.txt | AC | 21 ms | 3188 KB |
sample-02.txt | AC | 680 ms | 8052 KB |
sample-03.txt | AC | 19 ms | 3188 KB |
sample-04.txt | AC | 18 ms | 3188 KB |
test-1-01.txt | AC | 156 ms | 7996 KB |
test-1-02.txt | AC | 20 ms | 3188 KB |
test-1-03.txt | AC | 23 ms | 3188 KB |
test-1-04.txt | AC | 46 ms | 3572 KB |
test-1-05.txt | AC | 45 ms | 3572 KB |
test-1-06.txt | AC | 228 ms | 7924 KB |
test-1-07.txt | AC | 158 ms | 7996 KB |
test-1-08.txt | AC | 222 ms | 7996 KB |
test-1-09.txt | AC | 173 ms | 8052 KB |
test-1-10.txt | AC | 18 ms | 3188 KB |
test-1-11.txt | AC | 18 ms | 3188 KB |
test-1-12.txt | AC | 186 ms | 7996 KB |
test-1-13.txt | AC | 18 ms | 3188 KB |
test-1-14.txt | AC | 196 ms | 7996 KB |
test-1-15.txt | AC | 219 ms | 7996 KB |
test-2-01.txt | RE | 5135 ms | -603300 KB |
test-2-02.txt | TLE | 5521 ms | -601920 KB |
test-2-03.txt | RE | 5034 ms | -602500 KB |
test-2-04.txt | TLE | 5634 ms | -602032 KB |
test-2-05.txt | TLE | 5505 ms | -601888 KB |
test-2-06.txt | RE | 5133 ms | -601988 KB |
test-2-07.txt | TLE | 6107 ms | -601960 KB |
test-2-08.txt | RE | 5019 ms | -602000 KB |
test-2-09.txt | RE | 5031 ms | -602484 KB |
test-2-10.txt | RE | 5240 ms | -602012 KB |