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

23767번 - Access Denied 다국어인터랙티브

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

문제

Computer passwords have been around for a long time. In fact, 60 years ago \href{https://en.wikipedia.org/wiki/Compatible_Time-Sharing_System}{CTSS} was one of the first computers with a password. The implementation of this was very simple. In CTSS the password was stored in plain text in a file on disk. When logging in, the user would enter a password. The computer would then compare the password to the password on disk. If the comparison failed, it would deny access, if it succeeded, access would be allowed. Researchers at MIT were quick to discover several security flaws in this password system. We will explore one of them, the timing attack.

In a timing attack, we exploit that we can deduce a computation path from the time it takes to do the computation. In CTSS the password check was done using a simple string matching algorithm, similar to this:

bool CheckPassword(string pwd1, string pwd2) {
 if (pwd1.Length != pwd2.Length) {
 return false;
 }
 for (int i = 0; i < pwd1.Length; i++) {
 if (pwd1[i] != pwd2[i]) {
 return false;
 }
 }
 return true;
}

For the purpose of this problem, we will use a (very) simplified timing model and the above algorithm. The timing model looks as follows:

  • A branching statement (if or for) takes 1ドル$ ms.
  • An assignment, or update of a memory address takes 1ドル$ ms.
  • A comparison between two memory addresses takes 3ドル$ ms.
  • A return statement takes 1ドル$ ms.

The password consists of between 1ドル$ and 20ドル$ English letters, upper or lower case, and digits.

입력

출력

제한

인터랙션

This is an interactive problem. Your submission will be run against an interactor, which reads the standard output of your submission and writes to the standard input of your submission. This interaction needs to follow a specific protocol:

  • Your program first sends a password string, consisting of between 1ドル$ and 20ドル$ English letters, upper or lower case, and digits.
  • Depending on if the password is correct, the interactor then responds with either:
    • If the password is correct; "ACCESS GRANTED". Your program should then exit cleanly.
    • If the password is incorrect; "ACCESS DENIED ($t$ ms)", where $t$ is the time it took to verify the password in ms. Your program can then make another guess.

Make sure you flush the buffer after each write. You can guess at most 2ドル,500円$ times. A testing tool is provided to help you develop your solution.

예제 입력 1

ACCESS DENIED (5 ms)
ACCESS DENIED (41 ms)
ACCESS DENIED (68 ms)
ACCESS GRANTED

예제 출력 1

A
HunFhun
Hunter1
Hunter2

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2021 A번

  • 문제를 만든 사람: Bjarki Ágúst Guðmundsson, Pehr Söderman

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 2이다.
(追記) (追記ここまで)

출처

대학교 대회

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

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