Logo
(追記) (追記ここまで)

30231번 - The Duel of Smokin’ Joe 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB103330.000%

문제

In the wild west, they take their Computer Science very seriously. Smokin’ Joe is widely known for his skills, and outlaws come from across the land to challenge him in a good ol’ fashioned sortin’ duel. The way that outlaws duel in the wild west, of course, is trying to be the one who makes the last move to sort an array of integers.

One fateful day, Smokin’ Joe’s nemesis, an infamous character known as The Outlaw, came to town and challenged Joe to a duel. The rules of the duel are as follows: the outlaw will spin the chambers, and a random permutation of length n will fall out (a permutation of length n is an array of the integers from 1 to n in any order). Smokin’ Joe and The Outlaw will take turns swapping two elements in this permutation, until the permutation is sorted in increasing order. The winner is the player who makes the last swap. Once an element is in its final position (i.e., value k is at position k), that element cannot be moved for the rest of the game; otherwise, there are no restrictions on which two elements can be swapped.

Both Smokin’ Joe and The Outlaw will always play perfectly, i.e., they play to win and not necessarily to sort the list as quickly as possible. Can you predict who will win?

Given a permutation, predict the winner of the game, where players take turns swapping elements, and an element cannot move once it’s in its final sorted position. The winner is the person who makes the final move to sort the array. Note that Smokin’ Joe goes first, i.e., makes the first move.

입력

The input will consist of two lines. The first input line contains an integer, n (1 ≤ n ≤ 106), the length of the permutation. The second input line contains n distinct integers, the permutation. It is guaranteed that it will be a permutation of the integers from 1 to n, and the permutation is not already sorted.

출력

If Smokin’ Joe wins, print “Smokin Joe!” (note that the apostrophe of Smokin’ is omitted in the output since apostrophe may come out as different ASCII characters on different machines and may cause “format errors” in the output). If The Outlaw wins, print “Oh No!”.

제한

예제 입력 1

3
1 3 2

예제 출력 1

Smokin Joe!

예제 입력 2

4
4 3 2 1

예제 출력 2

Oh No!

힌트

출처

University > University of Central Florida > 2023 Local Programming Contest (Final Round) 8번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /