結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー silversmithsilversmith
提出日時 2021-06-18 15:13:07
言語 Rust
(1.77.0)
結果
AC  
実行時間 716 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 1,309 ms
コンパイル使用メモリ 146,392 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-04 09:17:51
合計ジャッジ時間 10,970 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 520 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 625 ms
4,380 KB
testcase_39 AC 628 ms
4,380 KB
testcase_40 AC 624 ms
4,380 KB
testcase_41 AC 628 ms
4,380 KB
testcase_42 AC 620 ms
4,376 KB
testcase_43 AC 682 ms
4,380 KB
testcase_44 AC 692 ms
4,380 KB
testcase_45 AC 716 ms
4,376 KB
testcase_46 AC 695 ms
4,380 KB
testcase_47 AC 706 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `N` should have a snake case name
  --> 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
  --> 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
  --> 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
  --> 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
  --> 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
  --> 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`

warning: 6 warnings emitted

ソースコード

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