Please sign in first.
Submission #25240438
Source Code Expand
import itertools
n = int(input())
s = [i for i in input()]
ans = 0
for i in range(1, n + 1):
h = list(itertools.combinations(s, i))
if i <= 2:
ans += len(h)
else:
for candidate in h:
l = [x for x in range(1, i + 1)]
comb = list(itertools.combinations(l, 3))
flag = True
for j in comb:
a, b, c = candidate[j[0] - 1], candidate[j[1] - 1], candidate[j[2] - 1]
if a == c:
if not a == b:
flag = False
if not flag:
break
if flag:
ans += 1
print(ans % 998244353)
Submission Info
| Submission Time | |
|---|---|
| Task | E - Chain Contestant |
| User | shirounagi |
| Language | PyPy3 (7.3.0) |
| Score | 0 |
| Code Size | 717 Byte |
| Status | TLE |
| Exec Time | 2235 ms |
| Memory | 927896 KiB |
Judge Result
| Set Name | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 500 | ||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt |
| All | sample_01.txt, sample_02.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 79 ms | 61880 KiB |
| sample_02.txt | TLE | 2219 ms | 486532 KiB |
| test_01.txt | AC | 71 ms | 61976 KiB |
| test_02.txt | TLE | 2233 ms | 798656 KiB |
| test_03.txt | TLE | 2219 ms | 374380 KiB |
| test_04.txt | TLE | 2234 ms | 927896 KiB |
| test_05.txt | TLE | 2232 ms | 813844 KiB |
| test_06.txt | TLE | 2231 ms | 768736 KiB |
| test_07.txt | TLE | 2234 ms | 910452 KiB |
| test_08.txt | TLE | 2235 ms | 909984 KiB |
| test_09.txt | TLE | 2232 ms | 804240 KiB |
| test_10.txt | TLE | 2230 ms | 807284 KiB |
| test_11.txt | TLE | 2234 ms | 855896 KiB |
| test_12.txt | TLE | 2234 ms | 873076 KiB |
| test_13.txt | TLE | 2234 ms | 863764 KiB |
| test_14.txt | TLE | 2234 ms | 862896 KiB |
| test_15.txt | TLE | 2234 ms | 850492 KiB |
| test_16.txt | TLE | 2234 ms | 845732 KiB |
| test_17.txt | TLE | 2234 ms | 831524 KiB |
| test_18.txt | TLE | 2234 ms | 823240 KiB |
| test_19.txt | TLE | 2234 ms | 863452 KiB |
| test_20.txt | TLE | 2234 ms | 867688 KiB |