結果
| 問題 |
No.505 カードの数式2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-14 00:10:06 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 736 bytes |
| コンパイル時間 | 16,132 ms |
| コンパイル使用メモリ | 378,708 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 20:02:21 |
| 合計ジャッジ時間 | 17,505 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 RE * 11 |
コンパイルメッセージ
warning: unused import: `std::arch::x86_64::_mm_packus_epi16` --> src/main.rs:1:5 | 1 | use std::arch::x86_64::_mm_packus_epi16; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
ソースコード
use std::arch::x86_64::_mm_packus_epi16;
fn main() {
let mut n = String::new();
std::io::stdin().read_line(&mut n).ok();
let n: usize = n.trim().parse().unwrap();
let mut a = String::new();
std::io::stdin().read_line(&mut a).ok();
let a: Vec<isize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
let mut cands = vec![a[0], a[0]];
for i in 1..n {
let mut ncands = vec![];
for &v in cands.iter() {
ncands.push(v + a[i]);
ncands.push(v - a[i]);
ncands.push(v * a[i]);
ncands.push(v / a[i]);
}
ncands.sort();
cands = vec![ncands[0], ncands[ncands.len()-1]];
}
println!("{}", cands[1]);
}