結果
問題 | No.3015 右に寄せろ! |
ユーザー |
|
提出日時 | 2025-01-25 18:54:33 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,024 bytes |
コンパイル時間 | 24,944 ms |
コンパイル使用メモリ | 384,416 KB |
実行使用メモリ | 27,452 KB |
最終ジャッジ日時 | 2025-01-26 00:01:42 |
合計ジャッジ時間 | 25,667 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 WA * 11 |
ソースコード
#[allow(unused_imports)]use std::{collections::*,cmp::*,mem::swap,time::Instant,io::{self, stdin, Read, read_to_string},hash::Hash,};#[allow(unused_imports)]use proconio::{input, input_interactive, marker::{*}};#[allow(unused_imports)]//use rand::{thread_rng, Rng, seq::SliceRandom};#[allow(unused_imports)]//use ac_library::{*};#[allow(dead_code)]const INF: i64 = 1<<61;#[allow(dead_code)]const MOD: i64 = 998244353;#[allow(dead_code)]const D: [(usize, usize); 4] = [(1, 0), (0, 1), (!0, 0), (0, !0)];//use proconio::fastout;//#[fastout]fn main(){input!{s: Chars,}let mut t = Vec::new();let mut z = 0;for &c in &s{t.push((c, 1));}t.dedup_by(|u, v| if u.0==v.0{*v = (u.0, u.1+v.1);true} else {false});let mut ans = 0;for &(c, v) in t.iter().rev(){if c=='1'{ans += z*(v/2);} else {z += v;}}println!("{}", ans);}