포럼
문제 ICPC00174

D. Debugging

설명

Your fancy debugger will not help you in this matter. There are many ways in which code can produce different behavior between debug and release builds, and when this happens, one may have to resort to more primitive forms of debugging.

So you and your printf are now on your own in the search for a line of code that causes the release build to crash. Still you are lucky: adding printf statements to this program affects neither the bug (it still crashes at the same original code line) nor the execution time (at least not notably). So even the naive approach of putting a printf statement before each line, running the program until it crashes, and checking the last printed line, would work.

However, it takes some time to add each printf statement to the code, and the program may have a lot of lines. So perhaps a better plan would involve putting a printf statement in the middle of the program, letting it run, seeing whether it crashes before the added line, and then continuing the search in either the first or second half of the code.

But then again, running the program may take a lot of time, so the most time-efficient strategy might be something in between. Write a program that computes the minimum worst-case time to find the crashing line (no matter where it is), assuming you choose an optimal strategy for placing your printf statements.

We're releasing the new version in five hours, so this issue is escalated and needs to be fixed ASAP.

제약
입력 형식

The input consists of one line with three integers:
- \(n\) (\(1 \le n \le 10^6\)), the number of code lines;
- \(r\) (\(1 \le r \le 10^9\)), the amount of time it takes to compile and run the program until it crashes;
- \(p\) (\(1 \le p \le 10^9\)), the time it takes to add a single printf line.

You have already run the program once and therefore already know that it does crash somewhere.

출력 형식

Output the worst-case time to find the crashing line when using an optimal strategy.

예제 1
입력
1 100 20
출력
0
예제 2
입력
10 10 1
출력
19
예제 3
입력
16 1 10
출력
44
문제 정보

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

출처 ICPC NWERC 2015

평가 및 의견

D. Debugging

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

Log in to rate problems.

개별 의견

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

풀이 제출

D. Debugging

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