結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-29 11:27:26 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 750 bytes |
| コンパイル時間 | 12,955 ms |
| コンパイル使用メモリ | 402,300 KB |
| 実行使用メモリ | 25,984 KB |
| 平均クエリ数 | 2.68 |
| 最終ジャッジ日時 | 2025-01-29 11:27:43 |
| 合計ジャッジ時間 | 15,684 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 WA * 3 |
ソースコード
fn c() -> String {
let mut s = String::new();
std::io::stdin().read_line(&mut s).unwrap();
s.trim().to_string()
}
fn main() {
let f: Vec<i64> = c().split_whitespace().flat_map(str::parse).collect();
let o = || {
println!("? 1 1");
c().parse::<i64>().unwrap()
};
match f.as_slice() {
[1, 1] => println!("! 1 1"),
[1, _] => {
let d = o();
println!("! 1 {}", d + 1);
}
[_, 1] => {
let d = o();
println!("! {} 1", d + 1);
}
_ => {
let u = o();
println!("? 1 {}", f[1]);
let v = c().parse::<i64>().unwrap();
let d = (u - v - 1 + f[1].pow(2)) / 2;
let y = (d / (f[1] - 1)).abs();
let x = (1..=f[0])
.find(|&x| (y - 1).pow(2) + (x - 1).pow(2) == u)
.unwrap();
println!("! {x} {y}");
}
}
}