結果

問題 No.3124 Twin
ユーザー White-Green
提出日時 2025-04-25 21:20:46
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 2,923 bytes
コンパイル時間 14,044 ms
コンパイル使用メモリ 386,964 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-25 21:21:16
合計ジャッジ時間 14,579 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports)]
#![allow(dead_code)]

use std::cell::RefCell;
use std::cmp::{Ordering, Reverse};
use std::collections::btree_map::Entry as BTreeMapEntry;
use std::collections::hash_map::{Entry as HashMapEntry, Entry};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::fmt::{Debug, Display, Formatter, Write};
use std::hash::Hash;
use std::io::{stdin, BufRead, BufWriter, Write as _};
use std::ops::{Bound, ControlFlow, Range, RangeBounds, RangeInclusive};
use std::rc::Rc;
use std::str::FromStr;
use std::sync::atomic;
use std::sync::atomic::AtomicUsize;
use std::thread::LocalKey;
use std::time::{Duration, Instant};
use std::{array, convert, io, iter, mem, ptr};

pub fn solve(InputObject { cin }: InputObject) {
    let x = cin.next::<usize>();
    let y = cin.next::<usize>();
    if x == y {
        println!("Yes");
    } else {
        println!("No");
    }
}

pub struct InputObject<'a> {
    cin: &'a mut ConsoleInput,
}

fn input(cin: &mut ConsoleInput) -> InputObject {
    InputObject { cin }
}

pub fn main() {
    let mut cin = ConsoleInput::new();
    let input = input(&mut cin);
    solve(input);
}

// libraries below
pub struct ConsoleInput {
    queue: VecDeque<String>,
}

pub trait Input {
    fn next<T: FromStr>(&mut self) -> T;
    fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }
}

pub trait Output {
    fn write(&self);
}

impl Output for () {
    fn write(&self) {}
}

impl Input for ConsoleInput {
    fn next<T: FromStr>(&mut self) -> T {
        match self.read().parse() {
            Ok(value) => value,
            _ => panic!("parse error"),
        }
    }
}

impl ConsoleInput {
    fn new() -> Self {
        Self {
            queue: VecDeque::new(),
        }
    }

    fn read(&mut self) -> String {
        loop {
            if let Some(s) = self.queue.pop_front() {
                return s;
            }
            let mut s = String::new();
            stdin().read_line(&mut s).expect("failed to read");
            for s in s.split_ascii_whitespace() {
                self.queue.push_back(String::from(s));
            }
        }
    }
}

fn binary_search(range: Range<usize>, f: impl Fn(usize) -> Ordering) -> Result<usize, usize> {
    let mut start = range.start;
    let mut len = range.len();
    if len == 0 {
        return Err(0);
    }
    while len > 1 {
        let half = len / 2;
        let mid = start + half;
        if f(mid) != Ordering::Greater {
            start = mid;
        }
        len -= half;
    }
    match f(start) {
        Ordering::Equal => Ok(start),
        Ordering::Less => Err(start + 1),
        Ordering::Greater => Err(start),
    }
}

fn all_bits() -> impl Iterator<Item = impl Iterator<Item = (usize, bool)>> {
    (0usize..).map(|i| (0usize..).map(move |j| (j, (i >> j) & 1 != 0)))
}

#[cfg(test)]
mod tests;
0