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

Zamjena

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

의견: 0

설명

1 \(s / 64\) \(MB / 70\) points

Vlatko likes to play with integer arrays. He wrote two arrays of \(N\) elements on a piece of paper, each

element being either a positive integer or a sequence of lowercase letters of the English alphabet

representing a variable. A variable can be replaced with an arbitrary integer. It's possible that both

arrays contain the same variable or the same variable occurs multiple times in an array. If that’s the

case, each occurence of the variable has to be replaced with the same integer in both arrays.

Vlatko wonders if it's possible to replace all variables with some integer values in such a way that the

two arrays become equal. Two arrays are considered equal if the numbers on the same positions in

the arrays are equal.

제약

In test cases worth 20% of the total points, each variable will occur exactly once in both arrays

combined.
In test cases worth additional 20% of the total points, there will be only two variables, ‘x’ and ‘y’. It’s

possible that the variables appear multiple times in both arrays.

입력 형식

The first line contains a positive integer \(N\) (1 ≤ \(N\) ≤ 50 000), the number of elements in each array.
The second line contains \(N\) elements of the first array.
The third line contains \(N\) elements of the second array.
Each element in both arrays can either be:

a positive integer less than 1 000 or

a sequence of lowercase letters of the English alphabet (no longer than 10 characters) which

represents a variable.

출력 형식

If it's possible to replace all variables with integer values in a way that the two arrays become equal,

print “DA” (Croatian for yes, without the quotation marks). Otherwise print “NE” (Croatian for no).

예제 1
입력
3
3 1 2
3 1 x

4
4 5 iks ipsilon
1 iks 3 iks

5
x 3 x y 3
x y 2 z 3
출력
output
output
DA

NE

DA




1 s / 64 MB / 70 points
설명

Clarification of the third sample test:
By introducing substitutions x = 2, y = 3, z = 3, both arrays will become equal (2 3 2 3 3).

문제 정보

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

출처 COCI 2018/2019 Contest 1

평가 및 의견

Zamjena

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

Log in to rate problems.

개별 의견

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

풀이 제출

Zamjena

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