結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-01 00:48:26 |
| 言語 | Rust (1.92.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 791 bytes |
| 記録 | |
| コンパイル時間 | 834 ms |
| コンパイル使用メモリ | 201,744 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-02-01 00:48:28 |
| 合計ジャッジ時間 | 2,173 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
fn main() {
let stdin = std::io::read_to_string(std::io::stdin()).unwrap();
let mut stdin = stdin.split_ascii_whitespace();
let n: usize = stdin.next().unwrap().parse().unwrap();
let equations: Vec<(i32, i32)> = (0..n)
.map(|_| {
(
stdin.next().unwrap().parse().unwrap(),
stdin.next().unwrap().parse().unwrap(),
)
})
.collect();
println!("{}", output(solve(equations)));
}
fn solve(equations: Vec<(i32, i32)>) -> i32 {
let candidate = equations[0].1 - equations[0].0;
if candidate.signum() != 1 {
return -1;
}
for (x, y) in equations {
if candidate + x != y {
return -1;
}
}
candidate
}
fn output(ans: i32) -> i32 {
ans
}