PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000400. Xóa số để tìm số bí mật (Deleting Numbers)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Xóa số để tìm số bí mật (Deleting Numbers)
Deleting Numbers
Source: Codeforces
Version: Phuoc Hung OJ Extended
Mode: interactive.
Problem Statement
An unknown integer is fixed by the judge. Initially a mutable set contains all numbers from 1 to . Discover using at most 10,000 operations:
A a, : get the number of currently present elements divisible by , without changing the set.B a, : first get the number of present multiples of , then delete all of them except the hidden number , which is never deleted.C a, : assert that and terminate. This command is only allowed once.
Read one integer response after A and B, and flush every command. Invalid commands and wrong guesses fail.
PHOJ hidden input
A hidden test file contains n x. Only is sent initially; the interactor maintains the set and responds to operations.
Subtasks
- Subtask 1 (20 points): , at most 10,000 operations.
- Subtask 2 (30 points): , at most 10,000 operations.
- Subtask 3 (50 points): , at most 10,000 operations.
Example interaction
For and hidden :
Judge: 10
Player: B 2
Judge: 5
Player: A 2
Judge: 1
Player: B 3
Judge: 3
Player: A 3
Judge: 1
Player: C 6
Explanation: B 2 reports 5 multiples and deletes 2,4,8,10, retaining 6. Hence A 2 returns 1. Next, B 3 sees 3,6,9, removes 3 and 9 and retains 6; A 3 returns 1. The interaction shown is only illustrative.