結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー silversmith
提出日時 2021-06-18 15:13:07
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 626 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 21,038 ms
コンパイル使用メモリ 393,716 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 08:22:55
合計ジャッジ時間 22,090 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 48
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `N` should have a snake case name
  --> src/main.rs:10:6
   |
10 |     let N:i32=s[0].parse().unwrap();
   |         ^ help: convert the identifier to snake case: `n`
   |
   = note: `#[warn(non_snake_case)]` on by default

warning: variable `M` should have a snake case name
  --> src/main.rs:11:6
   |
11 |     let M:i32=s[1].parse().unwrap();
   |         ^ help: convert the identifier to snake case: `m`

warning: variable `A` should have a snake case name
  --> src/main.rs:13:9
   |
13 |     let A:Vec<_>=s.trim().split(' ').collect();
   |         ^ help: convert the identifier to snake case: `a`

warning: variable `B` should have a snake case name
  --> src/main.rs:15:9
   |
15 |     let B:Vec<_>=s.trim().split(' ').collect();
   |         ^ help: convert the identifier to snake case: `b`

warning: variable `X` should have a snake case name
  --> src/main.rs:17:13
   |
17 |         let X:i32=A[(i % N) as usize].parse().unwrap();
   |             ^ help: convert the identifier to snake case (notice the capitalization): `x`

warning: variable `Y` should have a snake case name
  --> src/main.rs:18:13
   |
18 |         let Y:i32=B[(i % M) as usize].parse().unwrap();
   |             ^ help: convert the identifier to snake case (notice the capitalization): `y`

ソースコード

diff #

fn getline() -> String{
	let mut __ret=String::new();
	std::io::stdin().read_line(&mut __ret).ok();
	return __ret;
}

fn main(){
	let s=getline();
	let s:Vec<_>=s.trim().split(' ').collect();
	let N:i32=s[0].parse().unwrap();
	let M:i32=s[1].parse().unwrap();
    let s=getline();
    let A:Vec<_>=s.trim().split(' ').collect();
    let s=getline();
    let B:Vec<_>=s.trim().split(' ').collect();
	for i in 0..N*M+1 {
        let X:i32=A[(i % N) as usize].parse().unwrap();
        let Y:i32=B[(i % M) as usize].parse().unwrap();
        if X == Y {
            print!("{}", i+1);
            break;
        }
        if i == N*M {
            print!("{}", -1);
            break;
        }
    }
}
0