RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00516

Parametriziran

Unrated 레이팅 미적용
난이도
3s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

3 \(s / 64\) \(MB / 110\) points

A string of characters consisting of lowercase letters of the English alphabet and question marks is

called a parameterized word (e.g., a??cd , bcd , ?? ). Two parameterized words are considered similar

if the question mark symbols in both words can be replaced by arbitrary lowercase letters of the

english alphabet so that the resulting strings are the same. For example, parameterized words a???

and ?b?a are similar because by replacing the question marks in both words it is possible to obtain

the word abba .

Mirko has recently bought a collection of parametrized words. Among the \(N\) words found in the

collection, Mirko is interested in how many pairs of similar parameterized words exist. All the words in

the collection have the same number of characters, \(M\) , and it is possible that a word occurs multiple

times in the collection.

제약

In the test samples totally worth 30% of the points it will be valid \(M\) ≤ 2.
In the test samples totally worth additional 30% points it will be valid \(M\) ≤ 4.

입력 형식

The first line contains the integer numbers N (\(1 \le N \le 50\,000\)) and M (\(1 \le M \le 6\)).
Each of the following \(N\) lines contains one parameterized word from the collection with exactly \(M\)

characters.

출력 형식

Print the total number of similar pairs of parameterized words.

예제 1
입력
3 3
??b
c??
c?c

4 6
ab??c?
??kll?
a?k??c
?bcd??

5 2
??
b?
c?
?g
cg
출력
output
output
2

3

8
설명

Explanation of the first test sample:
Pairs of similar words are: (??b, c??) and (c??, c?c).

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2018/2019 Contest 5

평가 및 의견

Parametriziran

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Parametriziran

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8