結果
| 問題 | No.3745 Line Seats |
| ユーザー |
norioc
|
| 提出日時 | 2026-09-23 15:03:00 |
| 言語 | Rust (1.97.1 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 2 ms / 2,000 ms |
| + 321µs | |
| コード長 | 1,371 bytes |
| 記録 | |
| コンパイル時間 | 4,398 ms |
| コンパイル使用メモリ | 195,088 KB |
| 実行使用メモリ | 9,924 KB |
| 最終ジャッジ日時 | 2026-09-23 15:03:07 |
| 合計ジャッジ時間 | 6,651 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| 部分点 | 20 % | AC * 47 |
| 満点 | 80 % | AC * 60 |
| 合計 | 2 * 100% = 200 点 |
ソースコード
#![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 dist = 0;
let mut p = 0;
let mut ans = 0;
for (i, x) in g.iter().enumerate() {
let w = x.len();
if x[0] == '.' {
let d = if i == 0 || i == g.len()-1 {
w
} else {
(w+1) / 2
};
if dist < d {
dist = d;
if i == 0 {
ans = 0
} else if i == g.len()-1 {
ans = N-1
} else {
ans = p + d - 1;
}
}
}
p += x.len();
}
println!("{}", ans+1);
}
norioc