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

Ispit

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

의견: 0

설명

2 \(s / 64\) \(MB / 90\) points

After 26 years of studying, little Mirko took his potentially last exam. He confidently took his seat,

sharpened his pencil and waited calmly for the professor's permission to start writing – after all, that

was his favorite subject, Data Structures and Algorithms . But, as in any good story, this one also has

that but ... Namely, when he got his exam, Mirko could not even comprehend what was written in it.

He only saw a meaningless matrix of letters with \(N\) rows and \(N\) columns.

Since the professor forbid leaving the classroom during the exam, Mirko decided to spend 2 hours

coming up with his own task. Mirko was wondering if it is possible to select \(K\) consecutive columns of

the matrix so that, after arbitrarily shuffling letters in the \(K\) selected columns’ rows, there are two

equal rows of the matrix. Shuffling is allowed only inside of the same row within selected columns

and it is possible that a row remains unchanged after such operation.

Can you solve Mirko's task?

제약

In the test samples totally worth 30% of the points it will hold \(N\) ≤ 10.
In the test samples totally worth additional 40% of the points it will hold \(N\) ≤ 200.

입력 형식

In the first line of the input there are two integer numbers \(N\) and \(K\) (2 ≤ \(K\)\(N\) ≤ 500).
The following \(N\) rows contain \(N\) lowercase letters of the english alphabet describing the matrix of the

letters Mirko saw in the exam.

출력 형식

Print “DA” (Croatian for yes, without the quotation marks) if it is possible to select the \(K\) consecutive

columns that meet the conditions of the task. Otherwise print “NE” (Croatian for no, also without

quotation marks).

예제 1
입력
4 2
abcd
acbd
enaa
moze

2 2
aa
aa

3 2
nec
uuc
iti
출력
output
output
DA

DA

NE




2 s / 64 MB / 90 points
설명

Explanation of the first test sample:

E.g. we can choose columns 2 and 3 and change the matrix so that it looks like this (we can choose not to

change the first row and swap 2 nd and 3 rd letters in other rows):
abcd
abcd
eana
mzoe

It is clear that the first and the second row are the same, thus satisfying the task condition.

문제 정보

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

출처 COCI 2018/2019 Contest 5

평가 및 의견

Ispit

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

Log in to rate problems.

개별 의견

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

풀이 제출

Ispit

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