結果

問題 No.3655 Adjacent Pairs in Triplets
コンテスト
ユーザー norioc
提出日時 2026-08-30 13:42:22
言語 Rust
(1.97.1 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 1 ms / 2,000 ms
+ 919µs
コード長 686 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,407 ms
コンパイル使用メモリ 184,208 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-30 13:42:28
合計ジャッジ時間 4,236 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#![allow(non_snake_case, unused_imports)]

use std::collections::{BinaryHeap, HashMap, HashSet};
use proconio::{input, marker::Usize1, marker::Chars};
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! d {
    ( $( $x:expr ),* $(,)? ) => {
        eprintln!(
            concat!( $( stringify!($x), "={:?} " ),* ),
            $( $x ),*
        );
    };
}

#[allow(dead_code)]
fn yn(b: bool) -> &'static str {
    if b { "Yes" } else { "No" }
}

fn main() {
    input! {
        S: Chars,
    }

    let ans = S.iter()
        .tuple_windows()
        .filter(|(a, b, c)| {
            a != c && (a == b || b == c)
        })
        .count();

    println!("{}", ans);
}
0