結果
問題 | No.1909 Detect from Substrings |
ユーザー | siganai |
提出日時 | 2022-04-22 21:43:55 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 934 bytes |
コンパイル時間 | 434 ms |
コンパイル使用メモリ | 87,280 KB |
実行使用メモリ | 82,888 KB |
最終ジャッジ日時 | 2023-09-06 08:04:35 |
合計ジャッジ時間 | 8,246 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 145 ms
78,996 KB |
testcase_01 | AC | 138 ms
79,148 KB |
testcase_02 | AC | 138 ms
79,020 KB |
testcase_03 | AC | 137 ms
78,800 KB |
testcase_04 | AC | 138 ms
79,152 KB |
testcase_05 | AC | 142 ms
79,224 KB |
testcase_06 | AC | 143 ms
79,296 KB |
testcase_07 | AC | 142 ms
79,156 KB |
testcase_08 | AC | 155 ms
82,512 KB |
testcase_09 | AC | 155 ms
82,740 KB |
testcase_10 | AC | 150 ms
81,932 KB |
testcase_11 | AC | 150 ms
81,788 KB |
testcase_12 | AC | 146 ms
80,052 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
ソースコード
#!/usr/bin/env PyPy3 from collections import Counter, defaultdict, deque import itertools import re import math from functools import reduce import operator import bisect import heapq import functools mod=10**9+7 import sys input=sys.stdin.readline n,m=map(int,input().split()) s=[input().rstrip() for _ in range(n)] ans = 0 for i in range(1,n): now = 0 for k in range(m): if now < m and s[0][k] == s[i][now]: now += 1 if now != m - 1: print(0) exit() if n == 2: c = 0 for j in range(m): if s[0][j] == s[1][j]: c += 1 if c >= m - 2: print(2) else: print(1) else: l = [0] * 26 for i in range(n): tmp = [0] * 26 for j in range(m): tmp[ord(s[i][j])-ord('a')] += 1 for j in range(26): l[j] = max(l[j],tmp[j]) if sum(l[j]) == m + 1: print(1) else: print(0)