Submission #26166444
Source Code Expand
n = int(input())
a = list(map(int, input().split()))
box = [0] * 10
mod = 998244353
for i in range(n - 1):
if i == 0:
box[(a[i] + a[i + 1]) % 10] += 1
box[(a[i] * a[i + 1]) % 10] += 1
else:
tmp = [0] * 10
for j in range(10):
if box[j] > 0:
tmp[(j + a[i + 1]) % 10] += box[j]
tmp[(j * a[i + 1]) % 10] += box[j]
box[j] = 0
box = tmp
for i in range(10):
box[i] %= mod
print('\n'.join(map(str, box)))
Submission Info
| Submission Time | |
|---|---|
| Task | D - FG operation |
| User | cubesat |
| Language | PyPy3 (7.3.0) |
| Score | 400 |
| Code Size | 534 Byte |
| Status | AC |
| Exec Time | 1114 ms |
| Memory | 110248 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 62 ms | 61824 KiB |
| 001.txt | AC | 47 ms | 61880 KiB |
| 002.txt | AC | 49 ms | 61576 KiB |
| 003.txt | AC | 139 ms | 81268 KiB |
| 004.txt | AC | 151 ms | 75432 KiB |
| 005.txt | AC | 65 ms | 73884 KiB |
| 006.txt | AC | 428 ms | 83708 KiB |
| 007.txt | AC | 200 ms | 78748 KiB |
| 008.txt | AC | 208 ms | 81636 KiB |
| 009.txt | AC | 62 ms | 68736 KiB |
| 010.txt | AC | 259 ms | 78008 KiB |
| 011.txt | AC | 329 ms | 81100 KiB |
| 012.txt | AC | 731 ms | 93868 KiB |
| 013.txt | AC | 1078 ms | 109668 KiB |
| 014.txt | AC | 1089 ms | 109876 KiB |
| 015.txt | AC | 1079 ms | 109612 KiB |
| 016.txt | AC | 1114 ms | 110248 KiB |
| 017.txt | AC | 1087 ms | 110028 KiB |
| example0.txt | AC | 62 ms | 61692 KiB |
| example1.txt | AC | 51 ms | 61872 KiB |