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

Prijateljice

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

의견: 0

설명

One summer night in Krk, Leona and Zoe went for a walk. On their winding path,
they found a pile of words! Excited by that, they quickly started collecting them:
Leona collected \(n\) words, and Zoe \(m\) words. After admiring them for a while, they
decided to play the following game:
In one move a player says a word from her pile. The player chooses the word in
such a way that the following conditions are met: the word is lexicographically
greater than the previous word, and it begins with the same letter as the previous
word or with the first letter of the English alphabet after it. If a player can’t make a move, she loses.
They alternate turns, and Leona plays first by saying her lexicographically smallest word. If Leona and
Zoe play optimally, determine who wins.
Note: The word \(A\) \(is\) lexicographically smaller than the word \(B\) \(if\) the word \(A\) \(is\) \(a\) prefix \(of\) the word \(B\) \(or\)
\(if\) \(in\) the first position \(in\) which the words \(A\) and \(B\) differ the letter \(in\) \(A\) \(at\) that position comes before the
letter \(in\) \(B\) \(at\) that position.

제약

Subtask 1 (20 points): n, \(m \le 100\), each word contains at most 10 letters

Subtask 2 (30 points): n, \(m \le 1\,000\)

Subtask 3 (60 points): No additional constraints.

입력 형식

The first line contains integers \(n\) and \(m\) (\(1 \le n\), \(m \le 10^{5}\)), the number of Leona’s words, and the number
of Zoe’s words.
The following \(n\) lines contain Leona’s words.
The following \(m\) lines contain Zoe’s words.
Words from the input contain only lowercase letters of the English alphabet, all words are mutually
distinct, their total length is at most \(10^{6}\), and Leona’s and Zoe’s words are lexicographically sorted.

출력 형식

Output Leona or Zoe, the name of the winner.

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

1

20점

n, \(m \le 100\), each word contains at most 10 letters

2

30점

n, \(m \le 1\,000\)

3

60점

No additional constraints.

예제 1
입력
2 1
avokado
dabar
brazil
출력
Zoe
예제 2
입력
3 3
ananas
atlas
banana
albatros
cikla
nogomet
출력
Leona
예제 3
입력
2 2
hrvatska
zastava
bijeli
galeb
출력
Leona
설명

Clarification of the first example:
Leona starts with the word avokado, then Zoe continues with her only word brazil. Leona can’t make
any move so she loses.

문제 정보

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

출처 COCI 2022/2023 Contest 2

평가 및 의견

Prijateljice

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

Log in to rate problems.

개별 의견

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

풀이 제출

Prijateljice

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