Submission #3454553
Source Code Expand
N = int(input()) S = [] for i in range(2): S.append(input()) mod = 7 + 10**9 if S[0][0] == S[1][0]: #縦置き ans, pre = 3, "v" i = 1 else: #横置き ans, pre = 6, "w" i = 2 while i < N: if S[0][i] == S[1][i]: #縦置き if pre == "v": #左が縦置き ans *= 2 ans %= mod else: #左が横置き pre = "v" i += 1 else: #横置き if pre == "v": #左が縦置き ans *= 2 ans %= mod pre = "w" else: #左が横置き ans *= 3 ans %= mod i += 2 print(ans)
Submission Info
Submission Time | |
---|---|
Task | D - Coloring Dominoes |
User | earlgrey_yh |
Language | Python (3.4.3) |
Score | 400 |
Code Size | 660 Byte |
Status | AC |
Exec Time | 17 ms |
Memory | 3064 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | AC | 17 ms | 3064 KB |
10.txt | AC | 17 ms | 3064 KB |
11.txt | AC | 17 ms | 3064 KB |
12.txt | AC | 17 ms | 3064 KB |
13.txt | AC | 17 ms | 3064 KB |
14.txt | AC | 17 ms | 3064 KB |
15.txt | AC | 17 ms | 3064 KB |
16.txt | AC | 17 ms | 3064 KB |
17.txt | AC | 17 ms | 3064 KB |
18.txt | AC | 17 ms | 3064 KB |
19.txt | AC | 17 ms | 3064 KB |
2.txt | AC | 17 ms | 3064 KB |
20.txt | AC | 17 ms | 3064 KB |
21.txt | AC | 17 ms | 3064 KB |
22.txt | AC | 17 ms | 3064 KB |
3.txt | AC | 17 ms | 3064 KB |
4.txt | AC | 17 ms | 3064 KB |
5.txt | AC | 17 ms | 3064 KB |
6.txt | AC | 17 ms | 3064 KB |
7.txt | AC | 17 ms | 3064 KB |
8.txt | AC | 17 ms | 3064 KB |
9.txt | AC | 17 ms | 3064 KB |
sample1.txt | AC | 17 ms | 3064 KB |
sample2.txt | AC | 17 ms | 3064 KB |
sample3.txt | AC | 17 ms | 3064 KB |