/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 284.0 KiB
#2 Accepted 1ms 284.0 KiB
#3 Accepted 3ms 284.0 KiB
#4 Accepted 4ms 284.0 KiB
#5 Accepted 2ms 284.0 KiB

Code

// Author: @Drydock

use std::io::{self, Read};

fn main() {

    solve();

}

fn solve() {

    let mut input = String::new();

    io::stdin().read_to_string(&mut input).unwrap();

    let mut it = I::new(&input);

    let t: usize = it.n();

    let mut o = String::new();

    for _ in 0..t {

        let n: usize = it.n();

        let s: String = it.n();

        let p: String = it.n();

        if s == p {

            o.push_str("YES\n");

            continue;

        }

        if n == 1 {

            o.push_str("NO\n");

            continue;

        }

        let b = p.as_bytes();

        let mut z = true;

        let c = b[0];

        for &x in b.iter() {

            if x != c {

                z = false;

                break;

            }

        }

        if z {

            o.push_str("NO\n");

        } else {

            o.push_str("YES\n");

        }

    }

    print!("{o}");

}

struct I<'a> {

    w: std::str::SplitWhitespace<'a>,

}

impl<'a> I<'a> {

    fn new(s: &'a str) -> Self {

        Self {

            w: s.split_whitespace(),

        }

    }

    fn n<T: std::str::FromStr>(&mut self) -> T {

        self.w.next().unwrap().parse().ok().unwrap()

    }

}

Information

Submit By
Type
Submission
Problem
P1233 B. Make Binary Strings Equal
Contest
Happy New Year 2026
Language
Rust 2021 (Rust 1.75.0)
Submit At
2026-01-06 17:13:54
Judged At
2026-01-06 17:13:54
Judged By
Score
100
Total Time
4ms
Peak Memory
284.0 KiB