結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
|
提出日時 | 2025-03-22 09:24:47 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,451 bytes |
コンパイル時間 | 12,648 ms |
コンパイル使用メモリ | 394,308 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-22 09:25:07 |
合計ジャッジ時間 | 19,382 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 WA * 12 |
コンパイルメッセージ
warning: value assigned to `ans` is never read --> src/main.rs:16:13 | 16 | let mut ans = (0,0,0,0); | ^^^ | = help: maybe it is overwritten before being read? = note: `#[warn(unused_assignments)]` on by default warning: comparison is useless due to type limits --> src/main.rs:22:81 | 22 | if p * a as i64 + q * b as i64 + r * c as i64 == t && c <= c && 0 <= d { | ^^^^^^ | = note: `#[warn(unused_comparisons)]` on by default
ソースコード
use proconio::input; fn main(){ input!{ a: usize, b: usize, c: usize, d: usize, n: usize, p: i64, q: i64, r: i64, s: i64, t: i64 } let mut ans = (0,0,0,0); if r == s { for a in 0..=a { for b in 0..=b { if a + b > n { continue; } let c = n - a - b; if p * a as i64 + q * b as i64 + r * c as i64 == t && c <= c && 0 <= d { ans = (a, b, c, 0); println!("{} {} {} {}", ans.0, ans.1, ans.2, ans.3); return; } } } } else { for a in 0..=a { for b in 0..=b { if a + b > n { continue; } let rem = t - p * a as i64 - q * b as i64 - s * (n - a - b) as i64; let denom = r - s; if rem % denom != 0 { continue; } let c_val = rem / denom; if c_val < 0 || c_val as usize > c { continue; } let c = c_val as usize; let di = n - a - b - c; if di > d { continue; } if p * a as i64 + q * b as i64 + r * c as i64 + s * di as i64 == t { ans = (a, b, c, di); println!("{} {} {} {}", ans.0, ans.1, ans.2, ans.3); return; } } } } }