結果
問題 | No.1818 6 Operations |
ユーザー | 37kt |
提出日時 | 2024-11-28 11:16:51 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 180 ms / 2,500 ms |
コード長 | 3,982 bytes |
コンパイル時間 | 14,097 ms |
コンパイル使用メモリ | 377,280 KB |
実行使用メモリ | 115,200 KB |
最終ジャッジ日時 | 2024-11-28 11:17:09 |
合計ジャッジ時間 | 18,394 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 1 ms
5,248 KB |
testcase_03 | AC | 1 ms
5,248 KB |
testcase_04 | AC | 1 ms
5,248 KB |
testcase_05 | AC | 1 ms
5,248 KB |
testcase_06 | AC | 1 ms
5,248 KB |
testcase_07 | AC | 1 ms
5,248 KB |
testcase_08 | AC | 53 ms
35,584 KB |
testcase_09 | AC | 114 ms
66,816 KB |
testcase_10 | AC | 52 ms
36,096 KB |
testcase_11 | AC | 49 ms
33,280 KB |
testcase_12 | AC | 89 ms
53,248 KB |
testcase_13 | AC | 64 ms
44,032 KB |
testcase_14 | AC | 78 ms
50,432 KB |
testcase_15 | AC | 93 ms
58,240 KB |
testcase_16 | AC | 72 ms
48,512 KB |
testcase_17 | AC | 110 ms
71,424 KB |
testcase_18 | AC | 174 ms
99,712 KB |
testcase_19 | AC | 145 ms
95,616 KB |
testcase_20 | AC | 162 ms
100,992 KB |
testcase_21 | AC | 180 ms
102,784 KB |
testcase_22 | AC | 133 ms
88,448 KB |
testcase_23 | AC | 178 ms
108,928 KB |
testcase_24 | AC | 154 ms
91,264 KB |
testcase_25 | AC | 177 ms
115,200 KB |
testcase_26 | AC | 150 ms
93,312 KB |
testcase_27 | AC | 167 ms
97,536 KB |
testcase_28 | AC | 54 ms
35,968 KB |
testcase_29 | AC | 49 ms
33,536 KB |
testcase_30 | AC | 180 ms
99,072 KB |
testcase_31 | AC | 161 ms
105,600 KB |
testcase_32 | AC | 180 ms
110,592 KB |
ソースコード
pub use __cargo_equip::prelude::*; use chminmax::chmin; use mvec::mvec; #[allow(unused_imports)] use proconio::{ input, marker::{Bytes, Chars, Usize1}, }; const INF: usize = 1 << 60; fn main() { input! { n: usize, m: usize, a: [usize; n], b: [usize; m], } let f = |a| { let mut c = vec![]; for &x in &a { c.push(0); c.extend(vec![1; x]); } c }; let a = f(a); let b = f(b); let n = a.len(); let m = b.len(); let mut dp = mvec![INF; n + 1; m + 1]; dp[0][0] = 0; for i in 0..=n { for j in 0..=m { if i < n { chmin!(dp[i + 1][j], dp[i][j] + 1); } if j < m { chmin!(dp[i][j + 1], dp[i][j] + 1); } if i < n && j < m { chmin!( dp[i + 1][j + 1], dp[i][j] + if a[i] == b[j] { 0 } else { 1 } ); } } } println!("{}", dp[n][m]); } // The following code was expanded by `cargo-equip`. /// # Bundled libraries /// /// - `chminmax 0.1.0 (path+████████████████████████████████████████████████████)` published in **missing** licensed under `CC0-1.0` as `crate::__cargo_equip::crates::chminmax` /// - `mvec 0.1.0 (path+████████████████████████████████████████████████)` published in **missing** licensed under `CC0-1.0` as `crate::__cargo_equip::crates::mvec` #[cfg_attr(any(), rustfmt::skip)] #[allow(unused)] mod __cargo_equip { pub(crate) mod crates { pub mod chminmax {pub use crate::__cargo_equip::macros::chminmax::*;#[macro_export]macro_rules!__cargo_equip_macro_def_chminmax_min{($a:expr$(,)*)=>{{$a}};($a:expr,$b:expr$(,)*)=>{{std::cmp::min($a,$b)}};($a:expr,$($rest:expr),+$(,)*)=>{{std::cmp::min($a,$crate::__cargo_equip::crates::chminmax::min!($($rest),+))}};}macro_rules!min{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_chminmax_min!{$($tt)*})}#[macro_export]macro_rules!__cargo_equip_macro_def_chminmax_max{($a:expr$(,)*)=>{{$a}};($a:expr,$b:expr$(,)*)=>{{std::cmp::max($a,$b)}};($a:expr,$($rest:expr),+$(,)*)=>{{std::cmp::max($a,$crate::__cargo_equip::crates::chminmax::max!($($rest),+))}};}macro_rules!max{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_chminmax_max!{$($tt)*})}#[macro_export]macro_rules!__cargo_equip_macro_def_chminmax_chmin{($base:expr,$($cmps:expr),+$(,)*)=>{{let cmp_min=$crate::__cargo_equip::crates::chminmax::min!($($cmps),+);if$base>cmp_min{$base=cmp_min;true}else{false}}};}macro_rules!chmin{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_chminmax_chmin!{$($tt)*})}#[macro_export]macro_rules!__cargo_equip_macro_def_chminmax_chmax{($base:expr,$($cmps:expr),+$(,)*)=>{{let cmp_max=$crate::__cargo_equip::crates::chminmax::max!($($cmps),+);if$base<cmp_max{$base=cmp_max;true}else{false}}};}macro_rules!chmax{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_chminmax_chmax!{$($tt)*})}} pub mod mvec {pub use crate::__cargo_equip::macros::mvec::*;#[macro_export]macro_rules!__cargo_equip_macro_def_mvec_mvec{($x:expr;$n:expr)=>{vec![$x;$n]};($x:expr;$n:expr$(;$m:expr)+)=>{vec![mvec![$x$(;$m)*];$n]};}macro_rules!mvec{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_mvec_mvec!{$($tt)*})}} } pub(crate) mod macros { pub mod chminmax {pub use crate::{__cargo_equip_macro_def_chminmax_chmax as chmax,__cargo_equip_macro_def_chminmax_chmin as chmin,__cargo_equip_macro_def_chminmax_max as max,__cargo_equip_macro_def_chminmax_min as min};} pub mod mvec {pub use crate::__cargo_equip_macro_def_mvec_mvec as mvec;} } pub(crate) mod prelude {pub use crate::__cargo_equip::crates::*;} mod preludes { pub mod chminmax {} pub mod mvec {} } }