結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー ixTL255
提出日時 2023-03-05 17:41:00
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 19,119 ms
コンパイル使用メモリ 399,936 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-18 01:38:50
合計ジャッジ時間 23,033 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 48
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable does not need to be mutable
 --> src/main.rs:4:9
  |
4 |     let mut itr = s.trim().split_whitespace();
  |         ----^^^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

ソースコード

diff #

fn read() -> Vec<usize> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    
    itr.map(|x| x.parse::<usize>().unwrap()).collect()
}

fn main() {
    let nm = read();
    let a = read();
    let b= read();

    for i in 0..nm[0] * nm[1] {
        if a[i % nm[0]] == b[i % nm[1]] {
            println!("{}", i + 1);
            return
        }
    }
    println!("{}", -1);
}
0