結果

問題 No.2073 Concon Substrings (Swap Version)
ユーザー phsplsphspls
提出日時 2022-09-19 04:36:36
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 142,492 KB
実行使用メモリ 4,968 KB
最終ジャッジ日時 2023-08-23 18:45:39
合計ジャッジ時間 2,787 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 6 ms
4,952 KB
testcase_06 AC 6 ms
4,884 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 11 ms
4,956 KB
testcase_11 AC 12 ms
4,908 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 10 ms
4,440 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 7 ms
4,968 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 6 ms
4,880 KB
testcase_20 AC 5 ms
4,376 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `n`
 --> Main.rs:5:9
  |
5 |     let n: usize = n.trim().parse().unwrap();
  |         ^ help: if this is intentional, prefix it with an underscore: `_n`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let s = s.trim().chars().collect::<Vec<char>>();

    let mut cnts = vec![vec![0usize; 3]; 3];
    for i in 0..s.len() {
        let c = s[i];
        if c == 'c' {
            cnts[0][i%3] += 1;
        } else if c == 'o' {
            cnts[1][i%3] += 1;
        } else if c == 'n' {
            cnts[2][i%3] += 1;
        }
    }
    println!("{}", (0..3).map(|i| cnts[0][i].min(cnts[1][(i+1)%3]).min(cnts[2][(i+2)%3])).sum::<usize>());
}
0