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

32886번 - Alternative Encryption 다국어투 스텝

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

문제

In the fight against theft of intellectual property by rivalling universities, TU Delft has decided to implement a system of secure communication, to be called New Well-Encrypted Remote Communication. All internal communication will be encrypted before being sent over the network, and then decrypted upon arrival. They have already set up the infra-structure, they have come to you for the encryption.

You are tasked to design an algorithm for both encryption and decryption of text consisting of only English lowercase letters. You do not need to tell them how you do it, in fact, they encourage you to keep it a secret, to improve security. Your algorithm only needs to meet the following criteria:

  • No matter what the text is, encrypting it and then decrypting the result should obviously yield the original text.
  • To make sure there are no issues with the transmission, the encrypted text should also consist of only English lowercase letters and should have the same number of letters as the original text.
  • To make sure the code cannot be broken easily, for all $i,ドル the $i$th letter of the encrypted text should differ from the $i$th letter of the original text.

The word "nwercjury" for example may not be encrypted as "irritating", because the number of letters does not match. Nor may you encrypt it as "imbecilic", since the fifth letter is a 'c' in both. An example of an acceptable encryption is "fantastic" (both have an 'n' and a 'c', but in different positions).

Your program will be run twice for each test case. In the first pass, your program will be given a number of strings to encrypt. In the second pass, your program will be given the strings as encrypted by the first pass, which it should then decrypt to retrieve the original input.

A testing tool is provided to help you develop your solution.

입력

The input consists of:

  • One line with either "encrypt" or "decrypt", indicating the action your program has to perform.
  • One line with an integer $n$ (1ドル \le n \le 1000$), the number of strings.
  • $n$ lines, each with a string $s$ (1ドル \le |s| \le 100$), the text to encrypt or decrypt. All input strings consist of only English lowercase letters (a-z).

출력

For each string, output its encryption or decryption, as required.

제한

예제 입력 1

encrypt
3
plaintext
nwerc
correct

예제 출력 1

encrypted
delft
balloon

예제 입력 2

decrypt
3
encrypted
delft
balloon

예제 출력 2

plaintext
nwerc
correct

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2024 연습 세션 A번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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