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

Set

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

의견: 0

설명

In the popular card game SET, the player’s goal is to identify a certain triplet
of cards with some special properties, called a set. Each card shows some figures,
which differ in number, shape, transparency and color.
Marin and Josip have recently bought a deck of these cards and now they can’t
stop playing. They’ve become so skilled at noticing sets that it soon became boring that the cards are
determined by only four properties. Thus, they have decided to have fun with a generalized version of the
game.
At their disposal is a deck of \(n\) different cards. Each card is represented by a sequence of \(k\) characters,
each being one of 1, 2 or 3. The order of the cards in the deck does not matter.
An unordered triplet of cards is called a set if for each of the \(k\) positions, the three characters corresponding
to the three cards are either the same or pairwise different. For example, three cards represented by 1123,
1322 and 1221 make a set because all of the characters in the first and third positions are the same (1
and 2 respectively), and the characters in the second and fourth positions are different (1, 2 and 3 in
some order).
While looking at these \(n\) cards on the table, they started to wonder: how many unordered triplets of these
\(n\) cards make a set. Write a program which will answer their question.

제약

Subtask 1 (10 points): \(1 \le k \le 5\)

Subtask 2 (30 points): \(1 \le k \le 7\)

Subtask 3 (70 points): \(1 \le k \le 12\)

입력 형식

The first line contains the integers \(n\) and \(k - th\)e number of cards in the deck and the number of properties
of a single card, respectively.
Each of the following \(n\) lines contains a sequence of \(k\) characters representing a card. Each character is
one of 1, 2 or 3. Different lines contain different sequences of characters.

출력 형식

In the only line, print the number of unordered triplets which form a set.

서브태스크
서브태스크점수설명

1

10점

\(1 \le k \le 5\)

2

30점

\(1 \le k \le 7\)

3

70점

\(1 \le k \le 12\)

예제 1
입력
3 4
1123
1322
1221
출력
1
예제 2
입력
2 2
11
22
출력
0
예제 3
입력
5 3
111
222
333
123
132
출력
2
설명

Clarification of the third example:
The two sets are 111, 222, 333 and 111, 123 i 132.

문제 정보

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

출처 COCI 2021/2022 Contest 1

평가 및 의견

Set

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

Log in to rate problems.

개별 의견

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

풀이 제출

Set

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