結果

問題 No.3745 Line Seats
ユーザー norioc
提出日時 2026-09-23 14:56:22
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 1,251 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 14,124 ms
コンパイル使用メモリ 189,440 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-09-23 14:56:40
合計ジャッジ時間 13,024 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
部分点 20 % AC * 33 WA * 14
満点 80 % AC * 46 WA * 14
合計 2 * 0% = 0 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#![allow(non_snake_case, unused_imports)]

use std::cmp::{min, max, Reverse};
use std::collections::{BinaryHeap, Bound, HashMap, HashSet, VecDeque};
use std::hash::Hash;
use std::ops::RangeBounds;
use ac_library::{Additive, Min, Segtree};
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! {
        N: usize,
        S: Chars,
    }

    let g = S
        .chunk_by(|a, b| a == b)
        .collect_vec();

    let mut width = 0;
    let mut p = 0;
    let mut ans = 0;

    for (i, x) in g.iter().enumerate() {
        if x[0] == '.' {
            let w = x.len();
            if width < w {
                width = w;
                if i == 0 {
                    ans = 0
                } else if i == g.len()-1 {
                    ans = N-1
                } else {
                    ans = p + (w-1) / 2;
                }
            }
        }

        p += x.len();
    }

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