結果
問題 |
No.3115 One Power One Kill
|
ユーザー |
|
提出日時 | 2025-04-19 18:33:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,141 bytes |
コンパイル時間 | 439 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 32,936 KB |
平均クエリ数 | 3.00 |
最終ジャッジ日時 | 2025-04-19 18:33:33 |
合計ジャッジ時間 | 5,834 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 20 |
ソースコード
import math def solve(): # Step 1: Output A and B # Choose A and B strategically to get meaningful gcd results A = 12345 # Example value, can be adjusted B = 67890 # Example value, can be adjusted print(A, B, flush=True) # Output A and B, and flush output # Step 2: Receive K from the judge K = int(input()) # Judge provides K = gcd(X, Y) # Step 3: Use K to narrow down possible X values possible_X = [] for i in range(1, 10**5 // K + 1): # Enumerate multiples of K X = K * i if 100 <= X <= 10**5: # Ensure X is within the valid range possible_X.append(X) # Step 4: Compute X' for each possible X and guess for X in possible_X: # Calculate X' = X^A mod B X_prime = pow(X, A, B) # Use Python's built-in pow with three arguments print(X_prime, flush=True) # Output the guess for X' and flush # Step 5: Receive the judge's response (ret) ret = int(input()) # Judge responds with 1 if correct, 0 otherwise if ret == 1: return # Correct guess, exit the function solve()