QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#795033#9810. Obliviate, Then Reincarnateucup-team296#AC ✓398ms94160kbRust54.2kb2024-11-30 17:33:052024-11-30 17:33:06

Judging History

This is the latest submission verdict.

  • [2024-11-30 17:33:06]
  • Judged
  • Verdict: AC
  • Time: 398ms
  • Memory: 94160kb
  • [2024-11-30 17:33:05]
  • Submitted

answer

// https://contest.ucup.ac/contest/1865/problem/9810
pub mod solution {
//{"name":"M. Obliviate, Then Reincarnate","group":"Universal Cup - The 3rd Universal Cup. Stage 19: Shenyang","url":"https://contest.ucup.ac/contest/1865/problem/9810","interactive":false,"timeLimit":1000,"tests":[{"input":"3 2 3\n1 1\n-1 3\n1\n2\n3\n","output":"Yes\nYes\nNo\n"},{"input":"3 2 3\n1 1\n-1 0\n1\n2\n3\n","output":"No\nNo\nNo\n"}],"testType":"single","input":{"type":"stdin","fileName":null,"pattern":null},"output":{"type":"stdout","fileName":null,"pattern":null},"languages":{"java":{"taskClass":"MObliviateThenReincarnate"}}}

use crate::algo_lib::collections::bit_set::BitSet;
use crate::algo_lib::graph::edges::edge::Edge;
use crate::algo_lib::graph::edges::edge_trait::EdgeTrait;
use crate::algo_lib::graph::strongly_connected_components::StronglyConnectedComponents;
use crate::algo_lib::graph::strongly_connected_components::StronglyConnectedComponentsTrait;
use crate::algo_lib::graph::Graph;
use crate::algo_lib::io::input::Input;
use crate::algo_lib::io::output::BoolOutput;
use crate::algo_lib::io::output::Output;
use crate::algo_lib::misc::recursive_function::Callable2;
use crate::algo_lib::misc::recursive_function::RecursiveFunction2;
use crate::algo_lib::misc::test_type::TaskType;

use crate::algo_lib::misc::test_type::TestType;

type PreCalc = ();

fn solve(input: &mut Input, out: &mut Output, _test_case: usize, _data: &mut PreCalc) {
    let n = input.read_size();
    let m = input.read_size();
    let q = input.read_size();
    let edges = input.read_long_pair_vec(m);

    let mut graph = Graph::new(n);
    for (a, b) in edges {
        let a1 = ((a % (n as i64) + n as i64) % (n as i64)) as usize;
        let b1 = ((b % (n as i64) + n as i64) % (n as i64)) as usize;
        graph.add_edge(Edge::with_payload(a1, (a1 + b1) % n, b));
    }
    let StronglyConnectedComponents { color, condensed } = graph.strongly_connected_components();
    // let mut color = vec![0; n];
    let mut dist = vec![0; n];
    let mut good = BitSet::new(n);
    let mut done = BitSet::new(n);
    for i in 0..n {
        if !done[i] {
            let mut dfs = RecursiveFunction2::new(|f, vert: usize, val: i64| {
                if color[vert] != color[i] {
                    return;
                }
                if done[vert] {
                    if dist[vert] != val {
                        good.set(vert);
                    }
                    return;
                }
                done.set(vert);
                dist[vert] = val;
                for e in &graph[vert] {
                    f.call(e.to(), val + e.payload());
                }
            });
            dfs.call(i, 0);
        }
    }
    let mut c_good = BitSet::new(condensed.vertex_count());
    for i in 0..n {
        if good[i] {
            c_good.set(color[i]);
        }
    }
    for i in (0..condensed.vertex_count()).rev() {
        for e in &condensed[i] {
            if c_good[e.to()] {
                c_good.set(i);
                break;
            }
        }
    }
    for _ in 0..q {
        let x = input.read_long();
        let x1 = ((x % (n as i64) + n as i64) % (n as i64)) as usize;
        out.print_line(c_good[color[x1]]);
    }
}

pub static TEST_TYPE: TestType = TestType::Single;
pub static TASK_TYPE: TaskType = TaskType::Classic;

pub(crate) fn run(mut input: Input, mut output: Output) -> bool {
    let mut pre_calc = ();
    output.set_bool_output(BoolOutput::YesNo);

    match TEST_TYPE {
        TestType::Single => solve(&mut input, &mut output, 1, &mut pre_calc),
        TestType::MultiNumber => {
            let t = input.read();
            for i in 1..=t {
                solve(&mut input, &mut output, i, &mut pre_calc);
            }
        }
        TestType::MultiEof => {
            let mut i = 1;
            while input.peek().is_some() {
                solve(&mut input, &mut output, i, &mut pre_calc);
                i += 1;
            }
        }
    }
    output.flush();
    match TASK_TYPE {
        TaskType::Classic => input.is_empty(),
        TaskType::Interactive => true,
    }
}

}
pub mod algo_lib {
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::legacy_numeric_constants)]

pub mod collections {
pub mod bit_set {
use crate::algo_lib::collections::iter_ext::iter_copied::ItersCopied;
use crate::algo_lib::collections::slice_ext::legacy_fill::LegacyFill;
use crate::algo_lib::numbers::num_traits::bit_ops::BitOps;
use std::ops::BitAndAssign;
use std::ops::BitOrAssign;
use std::ops::Index;
use std::ops::ShlAssign;
use std::ops::ShrAssign;

const TRUE: bool = true;
const FALSE: bool = false;

#[derive(Clone, Eq, PartialEq, Hash)]
pub struct BitSet {
    data: Vec<u64>,
    len: usize,
}

impl BitSet {
    pub fn new(len: usize) -> Self {
        let data_len = if len == 0 {
            0
        } else {
            Self::index(len - 1) + 1
        };
        Self {
            data: vec![0; data_len],
            len,
        }
    }

    pub fn from_slice(len: usize, set: &[usize]) -> Self {
        let mut res = Self::new(len);
        for &i in set {
            res.set(i);
        }
        res
    }

    pub fn set(&mut self, at: usize) {
        assert!(at < self.len);
        self.data[Self::index(at)].set_bit(at & 63);
    }

    pub fn unset(&mut self, at: usize) {
        assert!(at < self.len);
        self.data[Self::index(at)].unset_bit(at & 63);
    }

    pub fn change(&mut self, at: usize, value: bool) {
        if value {
            self.set(at);
        } else {
            self.unset(at);
        }
    }

    pub fn flip(&mut self, at: usize) {
        self.change(at, !self[at]);
    }

    #[allow(clippy::len_without_is_empty)]
    pub fn len(&self) -> usize {
        self.len
    }

    pub fn fill(&mut self, value: bool) {
        // 1.43
        self.data.legacy_fill(if value { std::u64::MAX } else { 0 });
        if value {
            self.fix_last();
        }
    }

    pub fn is_superset(&self, other: &Self) -> bool {
        assert_eq!(self.len, other.len);
        for (we, them) in self.data.copy_zip(&other.data) {
            if (we & them) != them {
                return false;
            }
        }
        true
    }

    pub fn is_subset(&self, other: &Self) -> bool {
        other.is_superset(self)
    }

    pub fn iter(&self) -> impl Iterator<Item = usize> + '_ {
        self.into_iter()
    }

    fn index(at: usize) -> usize {
        at >> 6
    }

    pub fn count_ones(&self) -> usize {
        self.data.iter().map(|x| x.count_ones() as usize).sum()
    }

    fn fix_last(&mut self) {
        if self.len & 63 != 0 {
            let mask = (1 << (self.len & 63)) - 1;
            *self.data.last_mut().unwrap() &= mask;
        }
    }
}

pub struct BitSetIter<'s> {
    at: usize,
    inside: usize,
    set: &'s BitSet,
}

impl<'s> Iterator for BitSetIter<'s> {
    type Item = usize;

    fn next(&mut self) -> Option<Self::Item> {
        while self.at < self.set.data.len()
            && (self.inside == 64 || (self.set.data[self.at] >> self.inside) == 0)
        {
            self.at += 1;
            self.inside = 0;
        }
        if self.at == self.set.data.len() {
            None
        } else {
            while !self.set.data[self.at].is_set(self.inside) {
                self.inside += 1;
            }
            let res = self.at * 64 + self.inside;
            if res < self.set.len {
                self.inside += 1;
                Some(res)
            } else {
                None
            }
        }
    }
}

impl<'a> IntoIterator for &'a BitSet {
    type Item = usize;
    type IntoIter = BitSetIter<'a>;

    fn into_iter(self) -> Self::IntoIter {
        BitSetIter {
            at: 0,
            inside: 0,
            set: self,
        }
    }
}

impl BitOrAssign<&BitSet> for BitSet {
    fn bitor_assign(&mut self, rhs: &BitSet) {
        assert_eq!(self.len, rhs.len);
        for (i, &j) in self.data.iter_mut().zip(rhs.data.iter()) {
            *i |= j;
        }
    }
}

impl BitAndAssign<&BitSet> for BitSet {
    fn bitand_assign(&mut self, rhs: &BitSet) {
        assert_eq!(self.len, rhs.len);
        for (i, &j) in self.data.iter_mut().zip(rhs.data.iter()) {
            *i &= j;
        }
    }
}

impl ShlAssign<usize> for BitSet {
    fn shl_assign(&mut self, rhs: usize) {
        if rhs == 0 {
            return;
        }
        let small_shift = rhs & 63;
        if small_shift != 0 {
            let mut carry = 0;
            for data in self.data.iter_mut() {
                let new_carry = (*data) >> (64 - small_shift);
                *data <<= small_shift;
                *data |= carry;
                carry = new_carry;
            }
        }
        let big_shift = rhs >> 6;
        if big_shift != 0 {
            self.data.rotate_right(big_shift);
            self.data[..big_shift].fill(0);
        }
        self.fix_last();
    }
}

impl ShrAssign<usize> for BitSet {
    fn shr_assign(&mut self, rhs: usize) {
        if rhs == 0 {
            return;
        }
        let small_shift = rhs & 63;
        if small_shift != 0 {
            let mut carry = 0;
            for data in self.data.iter_mut().rev() {
                let new_carry = (*data) << (64 - small_shift);
                *data >>= small_shift;
                *data |= carry;
                carry = new_carry;
            }
        }
        let big_shift = rhs >> 6;
        if big_shift != 0 {
            self.data.rotate_left(big_shift);
            let from = self.data.len() - big_shift;
            self.data[from..].fill(0);
        }
    }
}

impl Index<usize> for BitSet {
    type Output = bool;

    fn index(&self, at: usize) -> &Self::Output {
        assert!(at < self.len);
        if self.data[Self::index(at)].is_set(at & 63) {
            &TRUE
        } else {
            &FALSE
        }
    }
}

impl From<Vec<bool>> for BitSet {
    fn from(data: Vec<bool>) -> Self {
        let mut res = Self::new(data.len());
        for (i, &value) in data.iter().enumerate() {
            res.change(i, value);
        }
        res
    }
}
}
pub mod dsu {
use crate::algo_lib::collections::iter_ext::collect::IterCollect;
use crate::algo_lib::collections::slice_ext::bounds::Bounds;
use crate::algo_lib::collections::slice_ext::indices::Indices;
use crate::algo_lib::collections::slice_ext::legacy_fill::LegacyFill;
use std::cell::Cell;

#[derive(Clone)]
pub struct DSU {
    id: Vec<Cell<u32>>,
    size: Vec<u32>,
    count: usize,
}

impl DSU {
    pub fn new(n: usize) -> Self {
        Self {
            id: (0..n).map(|i| Cell::new(i as u32)).collect_vec(),
            size: vec![1; n],
            count: n,
        }
    }

    pub fn size(&self, i: usize) -> usize {
        self.size[self.get(i)] as usize
    }

    #[allow(clippy::len_without_is_empty)]
    pub fn len(&self) -> usize {
        self.id.len()
    }

    pub fn iter(&self) -> impl Iterator<Item = usize> + '_ {
        self.id.iter().enumerate().filter_map(|(i, id)| {
            if (i as u32) == id.get() {
                Some(i)
            } else {
                None
            }
        })
    }

    pub fn set_count(&self) -> usize {
        self.count
    }

    pub fn join(&mut self, mut a: usize, mut b: usize) -> bool {
        a = self.get(a);
        b = self.get(b);
        if a == b {
            false
        } else {
            self.size[a] += self.size[b];
            self.id[b].replace(a as u32);
            self.count -= 1;
            true
        }
    }

    pub fn get(&self, i: usize) -> usize {
        if self.id[i].get() != i as u32 {
            let res = self.get(self.id[i].get() as usize);
            self.id[i].replace(res as u32);
        }
        self.id[i].get() as usize
    }

    pub fn clear(&mut self) {
        self.count = self.id.len();
        self.size.legacy_fill(1);
        self.id.iter().enumerate().for_each(|(i, id)| {
            id.replace(i as u32);
        });
    }

    pub fn parts(&self) -> Vec<Vec<usize>> {
        let roots = self.iter().collect_vec();
        let mut res = vec![Vec::new(); roots.len()];
        for i in self.id.indices() {
            res[roots.as_slice().bin_search(&self.get(i)).unwrap()].push(i);
        }
        res
    }
}
}
pub mod iter_ext {
pub mod collect {
pub trait IterCollect<T>: Iterator<Item = T> + Sized {
    fn collect_vec(self) -> Vec<T> {
        self.collect()
    }
}

impl<T, I: Iterator<Item = T> + Sized> IterCollect<T> for I {}
}
pub mod iter_copied {
use std::iter::Chain;
use std::iter::Copied;
use std::iter::Enumerate;
use std::iter::Filter;
use std::iter::Map;
use std::iter::Rev;
use std::iter::Skip;
use std::iter::StepBy;
use std::iter::Sum;
use std::iter::Take;
use std::iter::Zip;

pub trait ItersCopied<'a, T: 'a + Copy>: Sized + 'a
where
    &'a Self: IntoIterator<Item = &'a T>,
{
    fn copy_iter(&'a self) -> Copied<<&'a Self as IntoIterator>::IntoIter> {
        self.into_iter().copied()
    }
    fn copy_enumerate(&'a self) -> Enumerate<Copied<<&'a Self as IntoIterator>::IntoIter>> {
        self.copy_iter().enumerate()
    }
    fn copy_rev(&'a self) -> Rev<Copied<<&'a Self as IntoIterator>::IntoIter>>
    where
        Copied<<&'a Self as IntoIterator>::IntoIter>: DoubleEndedIterator,
    {
        self.copy_iter().rev()
    }
    fn copy_skip(&'a self, n: usize) -> Skip<Copied<<&'a Self as IntoIterator>::IntoIter>> {
        self.copy_iter().skip(n)
    }
    fn copy_take(&'a self, n: usize) -> Take<Copied<<&'a Self as IntoIterator>::IntoIter>> {
        self.copy_iter().take(n)
    }
    fn copy_chain<V>(
        &'a self,
        chained: &'a V,
    ) -> Chain<
        Copied<<&'a Self as IntoIterator>::IntoIter>,
        Copied<<&'a V as IntoIterator>::IntoIter>,
    >
    where
        &'a V: IntoIterator<Item = &'a T>,
    {
        self.copy_iter().chain(chained.into_iter().copied())
    }
    fn copy_zip<V>(
        &'a self,
        other: &'a V,
    ) -> Zip<Copied<<&'a Self as IntoIterator>::IntoIter>, Copied<<&'a V as IntoIterator>::IntoIter>>
    where
        &'a V: IntoIterator<Item = &'a T>,
    {
        self.copy_iter().zip(other.into_iter().copied())
    }
    fn copy_max(&'a self) -> T
    where
        T: Ord,
    {
        self.copy_iter().max().unwrap()
    }
    fn copy_max_by_key<B, F>(&'a self, f: F) -> T
    where
        F: FnMut(&T) -> B,
        B: Ord,
    {
        self.copy_iter().max_by_key(f).unwrap()
    }
    fn copy_min(&'a self) -> T
    where
        T: Ord,
    {
        self.copy_iter().min().unwrap()
    }
    fn copy_min_by_key<B, F>(&'a self, f: F) -> T
    where
        F: FnMut(&T) -> B,
        B: Ord,
    {
        self.copy_iter().min_by_key(f).unwrap()
    }
    fn copy_sum(&'a self) -> T
    where
        T: Sum<T>,
    {
        self.copy_iter().sum()
    }
    fn copy_map<F, U>(&'a self, f: F) -> Map<Copied<<&'a Self as IntoIterator>::IntoIter>, F>
    where
        F: FnMut(T) -> U,
    {
        self.copy_iter().map(f)
    }
    fn copy_all(&'a self, f: impl FnMut(T) -> bool) -> bool {
        self.copy_iter().all(f)
    }
    fn copy_any(&'a self, f: impl FnMut(T) -> bool) -> bool {
        self.copy_iter().any(f)
    }
    fn copy_step_by(&'a self, step: usize) -> StepBy<Copied<<&'a Self as IntoIterator>::IntoIter>> {
        self.copy_iter().step_by(step)
    }
    fn copy_filter<F: FnMut(&T) -> bool>(
        &'a self,
        f: F,
    ) -> Filter<Copied<<&'a Self as IntoIterator>::IntoIter>, F> {
        self.copy_iter().filter(f)
    }
    fn copy_fold<Acc, F>(&'a self, init: Acc, f: F) -> Acc
    where
        F: FnMut(Acc, T) -> Acc,
    {
        self.copy_iter().fold(init, f)
    }
    fn copy_reduce<F>(&'a self, f: F) -> Option<T>
    where
        F: FnMut(T, T) -> T,
    {
        self.copy_iter().reduce(f)
    }
    fn copy_position<P>(&'a self, predicate: P) -> Option<usize>
    where
        P: FnMut(T) -> bool,
    {
        self.copy_iter().position(predicate)
    }
}

impl<'a, U: 'a, T: 'a + Copy> ItersCopied<'a, T> for U where &'a U: IntoIterator<Item = &'a T> {}
}
}
pub mod slice_ext {
pub mod bounds {
pub trait Bounds<T: PartialOrd> {
    fn lower_bound(&self, el: &T) -> usize;
    fn upper_bound(&self, el: &T) -> usize;
    fn bin_search(&self, el: &T) -> Option<usize>;
    fn more(&self, el: &T) -> usize;
    fn more_or_eq(&self, el: &T) -> usize;
    fn less(&self, el: &T) -> usize;
    fn less_or_eq(&self, el: &T) -> usize;
}

impl<T: PartialOrd> Bounds<T> for [T] {
    fn lower_bound(&self, el: &T) -> usize {
        let mut left = 0;
        let mut right = self.len();
        while left < right {
            let mid = left + ((right - left) >> 1);
            if &self[mid] < el {
                left = mid + 1;
            } else {
                right = mid;
            }
        }
        left
    }

    fn upper_bound(&self, el: &T) -> usize {
        let mut left = 0;
        let mut right = self.len();
        while left < right {
            let mid = left + ((right - left) >> 1);
            if &self[mid] <= el {
                left = mid + 1;
            } else {
                right = mid;
            }
        }
        left
    }

    fn bin_search(&self, el: &T) -> Option<usize> {
        let at = self.lower_bound(el);
        if at == self.len() || &self[at] != el {
            None
        } else {
            Some(at)
        }
    }

    fn more(&self, el: &T) -> usize {
        self.len() - self.upper_bound(el)
    }

    fn more_or_eq(&self, el: &T) -> usize {
        self.len() - self.lower_bound(el)
    }

    fn less(&self, el: &T) -> usize {
        self.lower_bound(el)
    }

    fn less_or_eq(&self, el: &T) -> usize {
        self.upper_bound(el)
    }
}
}
pub mod indices {
use std::ops::Range;

pub trait Indices {
    fn indices(&self) -> Range<usize>;
}

impl<T> Indices for [T] {
    fn indices(&self) -> Range<usize> {
        0..self.len()
    }
}
}
pub mod legacy_fill {
// 1.50
pub trait LegacyFill<T> {
    fn legacy_fill(&mut self, val: T);
}

impl<T: Clone> LegacyFill<T> for [T] {
    fn legacy_fill(&mut self, val: T) {
        for el in self.iter_mut() {
            *el = val.clone();
        }
    }
}
}
}
pub mod vec_ext {
pub mod default {
pub fn default_vec<T: Default>(len: usize) -> Vec<T> {
    let mut v = Vec::with_capacity(len);
    for _ in 0..len {
        v.push(T::default());
    }
    v
}
}
}
}
pub mod graph {
use crate::algo_lib::collections::dsu::DSU;
use crate::algo_lib::graph::edges::bi_edge::BiEdge;
use crate::algo_lib::graph::edges::edge::Edge;
use crate::algo_lib::graph::edges::edge_trait::BidirectionalEdgeTrait;
use crate::algo_lib::graph::edges::edge_trait::EdgeTrait;
use std::ops::Index;
use std::ops::IndexMut;


#[derive(Clone)]
pub struct Graph<E: EdgeTrait> {
    edges: Vec<Vec<E>>,
    edge_count: usize,
}

impl<E: EdgeTrait> Graph<E> {
    pub fn new(vertex_count: usize) -> Self {
        Self {
            edges: vec![Vec::new(); vertex_count],
            edge_count: 0,
        }
    }

    pub fn add_edge(&mut self, (from, mut edge): (usize, E)) -> usize {
        let to = edge.to();
        assert!(to < self.vertex_count());
        let direct_id = self.edges[from].len();
        edge.set_id(self.edge_count);
        self.edges[from].push(edge);
        if E::REVERSABLE {
            let rev_id = self.edges[to].len();
            self.edges[from][direct_id].set_reverse_id(rev_id);
            let mut rev_edge = self.edges[from][direct_id].reverse_edge(from);
            rev_edge.set_id(self.edge_count);
            rev_edge.set_reverse_id(direct_id);
            self.edges[to].push(rev_edge);
        }
        self.edge_count += 1;
        direct_id
    }

    pub fn add_vertices(&mut self, cnt: usize) {
        self.edges.resize(self.edges.len() + cnt, Vec::new());
    }

    pub fn clear(&mut self) {
        self.edge_count = 0;
        for ve in self.edges.iter_mut() {
            ve.clear();
        }
    }

    pub fn vertex_count(&self) -> usize {
        self.edges.len()
    }

    pub fn edge_count(&self) -> usize {
        self.edge_count
    }

    pub fn degrees(&self) -> Vec<usize> {
        self.edges.iter().map(|v| v.len()).collect()
    }
}

impl<E: BidirectionalEdgeTrait> Graph<E> {
    pub fn is_tree(&self) -> bool {
        if self.edge_count + 1 != self.vertex_count() {
            false
        } else {
            self.is_connected()
        }
    }

    pub fn is_forest(&self) -> bool {
        let mut dsu = DSU::new(self.vertex_count());
        for i in 0..self.vertex_count() {
            for e in self[i].iter() {
                if i <= e.to() && !dsu.join(i, e.to()) {
                    return false;
                }
            }
        }
        true
    }

    pub fn is_connected(&self) -> bool {
        let mut dsu = DSU::new(self.vertex_count());
        for i in 0..self.vertex_count() {
            for e in self[i].iter() {
                dsu.join(i, e.to());
            }
        }
        dsu.set_count() == 1
    }
}

impl<E: EdgeTrait> Index<usize> for Graph<E> {
    type Output = [E];

    fn index(&self, index: usize) -> &Self::Output {
        &self.edges[index]
    }
}

impl<E: EdgeTrait> IndexMut<usize> for Graph<E> {
    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
        &mut self.edges[index]
    }
}

impl Graph<Edge<()>> {
    pub fn from_edges(n: usize, edges: &[(usize, usize)]) -> Self {
        let mut graph = Self::new(n);
        for &(from, to) in edges {
            graph.add_edge(Edge::new(from, to));
        }
        graph
    }
}

impl<P: Clone> Graph<Edge<P>> {
    pub fn from_edges_with_payload(n: usize, edges: &[(usize, usize, P)]) -> Self {
        let mut graph = Self::new(n);
        for (from, to, p) in edges.iter() {
            graph.add_edge(Edge::with_payload(*from, *to, p.clone()));
        }
        graph
    }
}

impl Graph<BiEdge<()>> {
    pub fn from_biedges(n: usize, edges: &[(usize, usize)]) -> Self {
        let mut graph = Self::new(n);
        for &(from, to) in edges {
            graph.add_edge(BiEdge::new(from, to));
        }
        graph
    }
}

impl<P: Clone> Graph<BiEdge<P>> {
    pub fn from_biedges_with_payload(n: usize, edges: &[(usize, usize, P)]) -> Self {
        let mut graph = Self::new(n);
        for (from, to, p) in edges.iter() {
            graph.add_edge(BiEdge::with_payload(*from, *to, p.clone()));
        }
        graph
    }
}
pub mod edges {
pub mod bi_edge {
use crate::algo_lib::graph::edges::bi_edge_trait::BiEdgeTrait;
use crate::algo_lib::graph::edges::edge_id::EdgeId;
use crate::algo_lib::graph::edges::edge_id::NoId;
use crate::algo_lib::graph::edges::edge_id::WithId;
use crate::algo_lib::graph::edges::edge_trait::BidirectionalEdgeTrait;
use crate::algo_lib::graph::edges::edge_trait::EdgeTrait;

#[derive(Clone)]
pub struct BiEdgeRaw<Id: EdgeId, P> {
    to: u32,
    id: Id,
    payload: P,
}

impl<Id: EdgeId> BiEdgeRaw<Id, ()> {
    pub fn new(from: usize, to: usize) -> (usize, Self) {
        (
            from,
            Self {
                to: to as u32,
                id: Id::new(),
                payload: (),
            },
        )
    }
}

impl<Id: EdgeId, P> BiEdgeRaw<Id, P> {
    pub fn with_payload(from: usize, to: usize, payload: P) -> (usize, Self) {
        (from, Self::with_payload_impl(to, payload))
    }

    fn with_payload_impl(to: usize, payload: P) -> BiEdgeRaw<Id, P> {
        Self {
            to: to as u32,
            id: Id::new(),
            payload,
        }
    }
}

impl<Id: EdgeId, P: Clone> BidirectionalEdgeTrait for BiEdgeRaw<Id, P> {}

impl<Id: EdgeId, P: Clone> EdgeTrait for BiEdgeRaw<Id, P> {
    type Payload = P;

    const REVERSABLE: bool = true;

    fn to(&self) -> usize {
        self.to as usize
    }

    fn id(&self) -> usize {
        self.id.id()
    }

    fn set_id(&mut self, id: usize) {
        self.id.set_id(id);
    }

    fn reverse_id(&self) -> usize {
        panic!("no reverse id")
    }

    fn set_reverse_id(&mut self, _: usize) {}

    fn reverse_edge(&self, from: usize) -> Self {
        Self::with_payload_impl(from, self.payload.clone())
    }

    fn payload(&self) -> &P {
        &self.payload
    }
}

impl<Id: EdgeId, P: Clone> BiEdgeTrait for BiEdgeRaw<Id, P> {}

pub type BiEdge<P> = BiEdgeRaw<NoId, P>;
pub type BiEdgeWithId<P> = BiEdgeRaw<WithId, P>;
}
pub mod bi_edge_trait {
use crate::algo_lib::graph::edges::edge_trait::EdgeTrait;

pub trait BiEdgeTrait: EdgeTrait {}
}
pub mod edge {
use crate::algo_lib::graph::edges::edge_id::EdgeId;
use crate::algo_lib::graph::edges::edge_id::NoId;
use crate::algo_lib::graph::edges::edge_id::WithId;
use crate::algo_lib::graph::edges::edge_trait::EdgeTrait;

#[derive(Clone)]
pub struct EdgeRaw<Id: EdgeId, P> {
    to: u32,
    id: Id,
    payload: P,
}

impl<Id: EdgeId> EdgeRaw<Id, ()> {
    pub fn new(from: usize, to: usize) -> (usize, Self) {
        (
            from,
            Self {
                to: to as u32,
                id: Id::new(),
                payload: (),
            },
        )
    }
}

impl<Id: EdgeId, P> EdgeRaw<Id, P> {
    pub fn with_payload(from: usize, to: usize, payload: P) -> (usize, Self) {
        (from, Self::with_payload_impl(to, payload))
    }

    fn with_payload_impl(to: usize, payload: P) -> Self {
        Self {
            to: to as u32,
            id: Id::new(),
            payload,
        }
    }
}

impl<Id: EdgeId, P: Clone> EdgeTrait for EdgeRaw<Id, P> {
    type Payload = P;

    const REVERSABLE: bool = false;

    fn to(&self) -> usize {
        self.to as usize
    }

    fn id(&self) -> usize {
        self.id.id()
    }

    fn set_id(&mut self, id: usize) {
        self.id.set_id(id);
    }

    fn reverse_id(&self) -> usize {
        panic!("no reverse")
    }

    fn set_reverse_id(&mut self, _: usize) {
        panic!("no reverse")
    }

    fn reverse_edge(&self, _: usize) -> Self {
        panic!("no reverse")
    }

    fn payload(&self) -> &P {
        &self.payload
    }
}

pub type Edge<P> = EdgeRaw<NoId, P>;
pub type EdgeWithId<P> = EdgeRaw<WithId, P>;
}
pub mod edge_id {
pub trait EdgeId: Clone {
    fn new() -> Self;
    fn id(&self) -> usize;
    fn set_id(&mut self, id: usize);
}

#[derive(Clone)]
pub struct WithId {
    id: u32,
}

impl EdgeId for WithId {
    fn new() -> Self {
        Self { id: 0 }
    }

    fn id(&self) -> usize {
        self.id as usize
    }

    fn set_id(&mut self, id: usize) {
        self.id = id as u32;
    }
}

#[derive(Clone)]
pub struct NoId {}

impl EdgeId for NoId {
    fn new() -> Self {
        Self {}
    }

    fn id(&self) -> usize {
        panic!("Id called on no id")
    }

    fn set_id(&mut self, _: usize) {}
}
}
pub mod edge_trait {
pub trait EdgeTrait: Clone {
    type Payload;
    
    const REVERSABLE: bool;

    fn to(&self) -> usize;
    fn id(&self) -> usize;
    fn set_id(&mut self, id: usize);
    fn reverse_id(&self) -> usize;
    fn set_reverse_id(&mut self, reverse_id: usize);
    #[must_use]
    fn reverse_edge(&self, from: usize) -> Self;
    fn payload(&self) -> &Self::Payload;
}

pub trait BidirectionalEdgeTrait: EdgeTrait {}
}
}
pub mod strongly_connected_components {
use crate::algo_lib::collections::bit_set::BitSet;
use crate::algo_lib::graph::edges::edge::Edge;
use crate::algo_lib::graph::edges::edge_trait::EdgeTrait;
use crate::algo_lib::graph::Graph;
use crate::algo_lib::misc::recursive_function::Callable;
use crate::algo_lib::misc::recursive_function::RecursiveFunction;

pub struct StronglyConnectedComponents {
    pub color: Vec<usize>,
    pub condensed: Graph<Edge<()>>,
}

pub trait StronglyConnectedComponentsTrait {
    fn strongly_connected_components(&self) -> StronglyConnectedComponents;
}

impl<E: EdgeTrait> StronglyConnectedComponentsTrait for Graph<E> {
    fn strongly_connected_components(&self) -> StronglyConnectedComponents {
        assert!(!E::REVERSABLE);
        let n = self.vertex_count();
        let mut order = Vec::with_capacity(n);
        let mut color = vec![0; n];
        let mut visited = BitSet::new(n);
        for i in 0..n {
            if !visited[i] {
                let mut first_dfs = RecursiveFunction::new(|f, vert| {
                    if visited[vert] {
                        return;
                    }
                    visited.set(vert);
                    for e in self[vert].iter() {
                        f.call(e.to());
                    }
                    order.push(vert);
                });
                first_dfs.call(i);
            }
        }
        visited.fill(false);
        let mut res = Graph::new(0);
        let mut index = 0usize;
        let mut next = vec![n; n];
        let mut queue = Vec::with_capacity(n);
        let mut gt = Graph::new(n);
        for i in 0..n {
            for e in self[i].iter() {
                gt.add_edge(Edge::new(e.to(), i));
            }
        }
        for i in (0..n).rev() {
            if !visited[order[i]] {
                let key = i;
                let mut second_dfs = RecursiveFunction::new(|f, vert| {
                    if visited[vert] {
                        if color[vert] != index && next[color[vert]] != key {
                            next[color[vert]] = key;
                            queue.push(color[vert]);
                        }
                        return;
                    }
                    color[vert] = index;
                    visited.set(vert);
                    for e in gt[vert].iter() {
                        f.call(e.to());
                    }
                });
                second_dfs.call(order[i]);
                res.add_vertices(1);
                for j in queue.drain(..) {
                    res.add_edge(Edge::new(j, index));
                }
                index += 1;
            }
        }
        StronglyConnectedComponents {
            color,
            condensed: res,
        }
    }
}
}
}
pub mod io {
pub mod input {
use crate::algo_lib::collections::vec_ext::default::default_vec;
use std::io::Read;
use std::mem::MaybeUninit;

pub struct Input<'s> {
    input: &'s mut (dyn Read + Send),
    buf: Vec<u8>,
    at: usize,
    buf_read: usize,
}

macro_rules! read_impl {
    ($t: ty, $read_name: ident, $read_vec_name: ident) => {
        pub fn $read_name(&mut self) -> $t {
            self.read()
        }

        pub fn $read_vec_name(&mut self, len: usize) -> Vec<$t> {
            self.read_vec(len)
        }
    };

    ($t: ty, $read_name: ident, $read_vec_name: ident, $read_pair_vec_name: ident) => {
        read_impl!($t, $read_name, $read_vec_name);

        pub fn $read_pair_vec_name(&mut self, len: usize) -> Vec<($t, $t)> {
            self.read_vec(len)
        }
    };
}

impl<'s> Input<'s> {
    const DEFAULT_BUF_SIZE: usize = 4096;

    pub fn new(input: &'s mut (dyn Read + Send)) -> Self {
        Self {
            input,
            buf: default_vec(Self::DEFAULT_BUF_SIZE),
            at: 0,
            buf_read: 0,
        }
    }

    pub fn new_with_size(input: &'s mut (dyn Read + Send), buf_size: usize) -> Self {
        Self {
            input,
            buf: default_vec(buf_size),
            at: 0,
            buf_read: 0,
        }
    }

    pub fn get(&mut self) -> Option<u8> {
        if self.refill_buffer() {
            let res = self.buf[self.at];
            self.at += 1;
            if res == b'\r' {
                if self.refill_buffer() && self.buf[self.at] == b'\n' {
                    self.at += 1;
                }
                return Some(b'\n');
            }
            Some(res)
        } else {
            None
        }
    }

    pub fn peek(&mut self) -> Option<u8> {
        if self.refill_buffer() {
            let res = self.buf[self.at];
            Some(if res == b'\r' { b'\n' } else { res })
        } else {
            None
        }
    }

    pub fn skip_whitespace(&mut self) {
        while let Some(b) = self.peek() {
            if !b.is_ascii_whitespace() {
                return;
            }
            self.get();
        }
    }

    pub fn next_token(&mut self) -> Option<Vec<u8>> {
        self.skip_whitespace();
        let mut res = Vec::new();
        while let Some(c) = self.get() {
            if c.is_ascii_whitespace() {
                break;
            }
            res.push(c);
        }
        if res.is_empty() {
            None
        } else {
            Some(res)
        }
    }

    //noinspection RsSelfConvention
    pub fn is_exhausted(&mut self) -> bool {
        self.peek().is_none()
    }

    //noinspection RsSelfConvention
    pub fn is_empty(&mut self) -> bool {
        self.skip_whitespace();
        self.is_exhausted()
    }

    pub fn read<T: Readable>(&mut self) -> T {
        T::read(self)
    }

    pub fn read_vec<T: Readable>(&mut self, size: usize) -> Vec<T> {
        let mut res = Vec::with_capacity(size);
        for _ in 0..size {
            res.push(self.read());
        }
        res
    }

    pub fn read_char(&mut self) -> u8 {
        self.skip_whitespace();
        self.get().unwrap()
    }

    read_impl!(u32, read_unsigned, read_unsigned_vec);
    read_impl!(u64, read_u64, read_u64_vec);
    read_impl!(usize, read_size, read_size_vec, read_size_pair_vec);
    read_impl!(i32, read_int, read_int_vec, read_int_pair_vec);
    read_impl!(i64, read_long, read_long_vec, read_long_pair_vec);
    read_impl!(i128, read_i128, read_i128_vec);

    fn refill_buffer(&mut self) -> bool {
        if self.at == self.buf_read {
            self.at = 0;
            self.buf_read = self.input.read(&mut self.buf).unwrap();
            self.buf_read != 0
        } else {
            true
        }
    }
}

pub trait Readable {
    fn read(input: &mut Input) -> Self;
}

impl Readable for u8 {
    fn read(input: &mut Input) -> Self {
        input.read_char()
    }
}

impl<T: Readable> Readable for Vec<T> {
    fn read(input: &mut Input) -> Self {
        let size = input.read();
        input.read_vec(size)
    }
}

impl<T: Readable, const SIZE: usize> Readable for [T; SIZE] {
    fn read(input: &mut Input) -> Self {
        unsafe {
            let mut res = MaybeUninit::<[T; SIZE]>::uninit();
            for i in 0..SIZE {
                let ptr: *mut T = (*res.as_mut_ptr()).as_mut_ptr();
                ptr.add(i).write(input.read::<T>());
            }
            res.assume_init()
        }
    }
}

macro_rules! read_integer {
    ($($t:ident)+) => {$(
        impl Readable for $t {
            fn read(input: &mut Input) -> Self {
                input.skip_whitespace();
                let mut c = input.get().unwrap();
                let sgn = match c {
                    b'-' => {
                        c = input.get().unwrap();
                        true
                    }
                    b'+' => {
                        c = input.get().unwrap();
                        false
                    }
                    _ => false,
                };
                let mut res = 0;
                loop {
                    assert!(c.is_ascii_digit());
                    res *= 10;
                    let d = (c - b'0') as $t;
                    if sgn {
                        res -= d;
                    } else {
                        res += d;
                    }
                    match input.get() {
                        None => break,
                        Some(ch) => {
                            if ch.is_ascii_whitespace() {
                                break;
                            } else {
                                c = ch;
                            }
                        }
                    }
                }
                res
            }
        }
    )+};
}

read_integer!(i8 i16 i32 i64 i128 isize u16 u32 u64 u128 usize);

macro_rules! tuple_readable {
    ($($name:ident)+) => {
        impl<$($name: Readable), +> Readable for ($($name,)+) {
            fn read(input: &mut Input) -> Self {
                ($($name::read(input),)+)
            }
        }
    }
}

tuple_readable! {T}
tuple_readable! {T U}
tuple_readable! {T U V}
tuple_readable! {T U V X}
tuple_readable! {T U V X Y}
tuple_readable! {T U V X Y Z}
tuple_readable! {T U V X Y Z A}
tuple_readable! {T U V X Y Z A B}
tuple_readable! {T U V X Y Z A B C}
tuple_readable! {T U V X Y Z A B C D}
tuple_readable! {T U V X Y Z A B C D E}
tuple_readable! {T U V X Y Z A B C D E F}

impl Read for Input<'_> {
    fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
        if self.at == self.buf_read {
            self.input.read(buf)
        } else {
            let mut i = 0;
            while i < buf.len() && self.at < self.buf_read {
                buf[i] = self.buf[self.at];
                i += 1;
                self.at += 1;
            }
            Ok(i)
        }
    }
}
}
pub mod output {
use crate::algo_lib::collections::vec_ext::default::default_vec;
use std::cmp::Reverse;
use std::io::stderr;
use std::io::Stderr;
use std::io::Write;

#[derive(Copy, Clone)]
pub enum BoolOutput {
    YesNo,
    YesNoCaps,
    PossibleImpossible,
    Custom(&'static str, &'static str),
}

impl BoolOutput {
    pub fn output(&self, output: &mut Output, val: bool) {
        (if val { self.yes() } else { self.no() }).write(output);
    }

    fn yes(&self) -> &str {
        match self {
            BoolOutput::YesNo => "Yes",
            BoolOutput::YesNoCaps => "YES",
            BoolOutput::PossibleImpossible => "Possible",
            BoolOutput::Custom(yes, _) => yes,
        }
    }

    fn no(&self) -> &str {
        match self {
            BoolOutput::YesNo => "No",
            BoolOutput::YesNoCaps => "NO",
            BoolOutput::PossibleImpossible => "Impossible",
            BoolOutput::Custom(_, no) => no,
        }
    }
}

pub struct Output<'s> {
    output: &'s mut dyn Write,
    buf: Vec<u8>,
    at: usize,
    auto_flush: bool,
    bool_output: BoolOutput,
    precision: Option<usize>,
}

impl<'s> Output<'s> {
    const DEFAULT_BUF_SIZE: usize = 4096;

    pub fn new(output: &'s mut dyn Write) -> Self {
        Self {
            output,
            buf: default_vec(Self::DEFAULT_BUF_SIZE),
            at: 0,
            auto_flush: false,
            bool_output: BoolOutput::YesNoCaps,
            precision: None,
        }
    }

    pub fn new_with_auto_flush(output: &'s mut dyn Write) -> Self {
        Self {
            output,
            buf: default_vec(Self::DEFAULT_BUF_SIZE),
            at: 0,
            auto_flush: true,
            bool_output: BoolOutput::YesNoCaps,
            precision: None,
        }
    }

    pub fn flush(&mut self) {
        if self.at != 0 {
            self.output.write_all(&self.buf[..self.at]).unwrap();
            self.output.flush().unwrap();
            self.at = 0;
        }
    }

    pub fn print<T: Writable>(&mut self, s: T) {
        s.write(self);
        self.maybe_flush();
    }

    pub fn print_line<T: Writable>(&mut self, s: T) {
        self.print(s);
        self.put(b'\n');
        self.maybe_flush();
    }

    pub fn put(&mut self, b: u8) {
        self.buf[self.at] = b;
        self.at += 1;
        if self.at == self.buf.len() {
            self.flush();
        }
    }

    pub fn maybe_flush(&mut self) {
        if self.auto_flush {
            self.flush();
        }
    }

    pub fn print_per_line<T: Writable>(&mut self, arg: &[T]) {
        self.print_per_line_iter(arg.iter());
    }

    pub fn print_iter<T: Writable, I: Iterator<Item = T>>(&mut self, iter: I) {
        let mut first = true;
        for e in iter {
            if first {
                first = false;
            } else {
                self.put(b' ');
            }
            e.write(self);
        }
    }

    pub fn print_line_iter<T: Writable, I: Iterator<Item = T>>(&mut self, iter: I) {
        self.print_iter(iter);
        self.put(b'\n');
    }

    pub fn print_per_line_iter<T: Writable, I: Iterator<Item = T>>(&mut self, iter: I) {
        for e in iter {
            e.write(self);
            self.put(b'\n');
        }
    }

    pub fn set_bool_output(&mut self, bool_output: BoolOutput) {
        self.bool_output = bool_output;
    }
    pub fn set_precision(&mut self, precision: usize) {
        self.precision = Some(precision);
    }
    pub fn reset_precision(&mut self) {
        self.precision = None;
    }
    pub fn get_precision(&self) -> Option<usize> {
        self.precision
    }
}

impl Write for Output<'_> {
    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
        let mut start = 0usize;
        let mut rem = buf.len();
        while rem > 0 {
            let len = (self.buf.len() - self.at).min(rem);
            self.buf[self.at..self.at + len].copy_from_slice(&buf[start..start + len]);
            self.at += len;
            if self.at == self.buf.len() {
                self.flush();
            }
            start += len;
            rem -= len;
        }
        self.maybe_flush();
        Ok(buf.len())
    }

    fn flush(&mut self) -> std::io::Result<()> {
        self.flush();
        Ok(())
    }
}

pub trait Writable {
    fn write(&self, output: &mut Output);
}

impl Writable for &str {
    fn write(&self, output: &mut Output) {
        output.write_all(self.as_bytes()).unwrap();
    }
}

impl Writable for String {
    fn write(&self, output: &mut Output) {
        output.write_all(self.as_bytes()).unwrap();
    }
}

impl Writable for char {
    fn write(&self, output: &mut Output) {
        output.put(*self as u8);
    }
}

impl Writable for u8 {
    fn write(&self, output: &mut Output) {
        output.put(*self);
    }
}

impl<T: Writable> Writable for [T] {
    fn write(&self, output: &mut Output) {
        output.print_iter(self.iter());
    }
}

impl<T: Writable, const N: usize> Writable for [T; N] {
    fn write(&self, output: &mut Output) {
        output.print_iter(self.iter());
    }
}

impl<T: Writable + ?Sized> Writable for &T {
    fn write(&self, output: &mut Output) {
        T::write(self, output)
    }
}

impl<T: Writable> Writable for Vec<T> {
    fn write(&self, output: &mut Output) {
        self.as_slice().write(output);
    }
}

impl Writable for () {
    fn write(&self, _output: &mut Output) {}
}

macro_rules! write_to_string {
    ($($t:ident)+) => {$(
        impl Writable for $t {
            fn write(&self, output: &mut Output) {
                self.to_string().write(output);
            }
        }
    )+};
}

write_to_string!(u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize);

macro_rules! tuple_writable {
    ($name0:ident $($name:ident: $id:tt )*) => {
        impl<$name0: Writable, $($name: Writable,)*> Writable for ($name0, $($name,)*) {
            fn write(&self, out: &mut Output) {
                self.0.write(out);
                $(
                out.put(b' ');
                self.$id.write(out);
                )*
            }
        }
    }
}

tuple_writable! {T}
tuple_writable! {T U:1}
tuple_writable! {T U:1 V:2}
tuple_writable! {T U:1 V:2 X:3}
tuple_writable! {T U:1 V:2 X:3 Y:4}
tuple_writable! {T U:1 V:2 X:3 Y:4 Z:5}
tuple_writable! {T U:1 V:2 X:3 Y:4 Z:5 A:6}
tuple_writable! {T U:1 V:2 X:3 Y:4 Z:5 A:6 B:7}
tuple_writable! {T U:1 V:2 X:3 Y:4 Z:5 A:6 B:7 C:8}

impl<T: Writable> Writable for Option<T> {
    fn write(&self, output: &mut Output) {
        match self {
            None => (-1).write(output),
            Some(t) => t.write(output),
        }
    }
}

impl Writable for bool {
    fn write(&self, output: &mut Output) {
        let bool_output = output.bool_output;
        bool_output.output(output, *self)
    }
}

impl<T: Writable> Writable for Reverse<T> {
    fn write(&self, output: &mut Output) {
        self.0.write(output);
    }
}

static mut ERR: Option<Stderr> = None;

pub fn err() -> Output<'static> {
    unsafe {
        if ERR.is_none() {
            ERR = Some(stderr());
        }
        Output::new_with_auto_flush(ERR.as_mut().unwrap())
    }
}
}
}
pub mod misc {
pub mod recursive_function {
use std::marker::PhantomData;

macro_rules! recursive_function {
    ($name: ident, $trait: ident, ($($type: ident $arg: ident,)*)) => {
        pub trait $trait<$($type, )*Output> {
            fn call(&mut self, $($arg: $type,)*) -> Output;
        }

        pub struct $name<F, $($type, )*Output>
        where
            F: FnMut(&mut dyn $trait<$($type, )*Output>, $($type, )*) -> Output,
        {
            f: std::cell::UnsafeCell<F>,
            $($arg: PhantomData<$type>,
            )*
            phantom_output: PhantomData<Output>,
        }

        impl<F, $($type, )*Output> $name<F, $($type, )*Output>
        where
            F: FnMut(&mut dyn $trait<$($type, )*Output>, $($type, )*) -> Output,
        {
            pub fn new(f: F) -> Self {
                Self {
                    f: std::cell::UnsafeCell::new(f),
                    $($arg: Default::default(),
                    )*
                    phantom_output: Default::default(),
                }
            }
        }

        impl<F, $($type, )*Output> $trait<$($type, )*Output> for $name<F, $($type, )*Output>
        where
            F: FnMut(&mut dyn $trait<$($type, )*Output>, $($type, )*) -> Output,
        {
            fn call(&mut self, $($arg: $type,)*) -> Output {
                unsafe { (*self.f.get())(self, $($arg, )*) }
            }
        }
    }
}

recursive_function!(RecursiveFunction0, Callable0, ());
recursive_function!(RecursiveFunction, Callable, (Arg arg,));
recursive_function!(RecursiveFunction2, Callable2, (Arg1 arg1, Arg2 arg2,));
recursive_function!(RecursiveFunction3, Callable3, (Arg1 arg1, Arg2 arg2, Arg3 arg3,));
recursive_function!(RecursiveFunction4, Callable4, (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4,));
recursive_function!(RecursiveFunction5, Callable5, (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5,));
recursive_function!(RecursiveFunction6, Callable6, (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6,));
recursive_function!(RecursiveFunction7, Callable7, (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7,));
recursive_function!(RecursiveFunction8, Callable8, (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7, Arg8 arg8,));
recursive_function!(RecursiveFunction9, Callable9, (Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7, Arg8 arg8, Arg9 arg9,));
}
pub mod test_type {
pub enum TestType {
    Single,
    MultiNumber,
    MultiEof,
}

pub enum TaskType {
    Classic,
    Interactive,
}
}
}
pub mod numbers {
pub mod num_traits {
pub mod algebra {
use crate::algo_lib::numbers::num_traits::invertible::Invertible;
use std::ops::Add;
use std::ops::AddAssign;
use std::ops::Div;
use std::ops::DivAssign;
use std::ops::Mul;
use std::ops::MulAssign;
use std::ops::Neg;
use std::ops::Rem;
use std::ops::RemAssign;
use std::ops::Sub;
use std::ops::SubAssign;

pub trait Zero {
    fn zero() -> Self;
}

pub trait One {
    fn one() -> Self;
}

pub trait AdditionMonoid: Add<Output = Self> + AddAssign + Zero + Eq + Sized {}

impl<T: Add<Output = Self> + AddAssign + Zero + Eq> AdditionMonoid for T {}

pub trait AdditionMonoidWithSub: AdditionMonoid + Sub<Output = Self> + SubAssign {}

impl<T: AdditionMonoid + Sub<Output = Self> + SubAssign> AdditionMonoidWithSub for T {}

pub trait AdditionGroup: AdditionMonoidWithSub + Neg<Output = Self> {}

impl<T: AdditionMonoidWithSub + Neg<Output = Self>> AdditionGroup for T {}

pub trait MultiplicationMonoid: Mul<Output = Self> + MulAssign + One + Eq + Sized {}

impl<T: Mul<Output = Self> + MulAssign + One + Eq> MultiplicationMonoid for T {}

pub trait IntegerMultiplicationMonoid:
    MultiplicationMonoid + Div<Output = Self> + Rem<Output = Self> + DivAssign + RemAssign
{
}

impl<T: MultiplicationMonoid + Div<Output = Self> + Rem<Output = Self> + DivAssign + RemAssign>
    IntegerMultiplicationMonoid for T
{
}

pub trait MultiplicationGroup:
    MultiplicationMonoid + Div<Output = Self> + DivAssign + Invertible<Output = Self>
{
}

impl<T: MultiplicationMonoid + Div<Output = Self> + DivAssign + Invertible<Output = Self>>
    MultiplicationGroup for T
{
}

pub trait SemiRing: AdditionMonoid + MultiplicationMonoid {}

impl<T: AdditionMonoid + MultiplicationMonoid> SemiRing for T {}

pub trait SemiRingWithSub: AdditionMonoidWithSub + SemiRing {}

impl<T: AdditionMonoidWithSub + SemiRing> SemiRingWithSub for T {}

pub trait Ring: SemiRing + AdditionGroup {}

impl<T: SemiRing + AdditionGroup> Ring for T {}

pub trait IntegerSemiRing: SemiRing + IntegerMultiplicationMonoid {}

impl<T: SemiRing + IntegerMultiplicationMonoid> IntegerSemiRing for T {}

pub trait IntegerSemiRingWithSub: SemiRingWithSub + IntegerSemiRing {}

impl<T: SemiRingWithSub + IntegerSemiRing> IntegerSemiRingWithSub for T {}

pub trait IntegerRing: IntegerSemiRing + Ring {}

impl<T: IntegerSemiRing + Ring> IntegerRing for T {}

pub trait Field: Ring + MultiplicationGroup {}

impl<T: Ring + MultiplicationGroup> Field for T {}

macro_rules! zero_one_integer_impl {
    ($($t: ident)+) => {$(
        impl Zero for $t {
            fn zero() -> Self {
                0
            }
        }

        impl One for $t {
            fn one() -> Self {
                1
            }
        }
    )+};
}

zero_one_integer_impl!(i128 i64 i32 i16 i8 isize u128 u64 u32 u16 u8 usize);
}
pub mod bit_ops {
use crate::algo_lib::numbers::num_traits::algebra::One;
use crate::algo_lib::numbers::num_traits::algebra::Zero;
use std::ops::BitAnd;
use std::ops::BitAndAssign;
use std::ops::BitOr;
use std::ops::BitOrAssign;
use std::ops::BitXor;
use std::ops::BitXorAssign;
use std::ops::Not;
use std::ops::RangeInclusive;
use std::ops::Shl;
use std::ops::Sub;
use std::ops::ShlAssign;
use std::ops::Shr;
use std::ops::ShrAssign;

pub trait BitOps:
    Copy
    + BitAnd<Output = Self>
    + BitAndAssign
    + BitOr<Output = Self>
    + BitOrAssign
    + BitXor<Output = Self>
    + BitXorAssign
    + Not<Output = Self>
    + Shl<usize, Output = Self>
    + ShlAssign<usize>
    + Shr<usize, Output = Self>
    + ShrAssign<usize>
    + Zero
    + One
    + PartialEq
{
    #[inline]
    fn bit(at: usize) -> Self {
        Self::one() << at
    }

    #[inline]
    fn is_set(&self, at: usize) -> bool {
        (*self >> at & Self::one()) == Self::one()
    }

    #[inline]
    fn set_bit(&mut self, at: usize) {
        *self |= Self::bit(at)
    }

    #[inline]
    fn unset_bit(&mut self, at: usize) {
        *self &= !Self::bit(at)
    }

    #[must_use]
    #[inline]
    fn with_bit(mut self, at: usize) -> Self {
        self.set_bit(at);
        self
    }

    #[must_use]
    #[inline]
    fn without_bit(mut self, at: usize) -> Self {
        self.unset_bit(at);
        self
    }

    #[inline]
    fn flip_bit(&mut self, at: usize) {
        *self ^= Self::bit(at)
    }

    #[must_use]
    #[inline]
    fn flipped_bit(mut self, at: usize) -> Self {
        self.flip_bit(at);
        self
    }

    fn all_bits(n: usize) -> Self {
        let mut res = Self::zero();
        for i in 0..n {
            res.set_bit(i);
        }
        res
    }

    fn iter_all(n: usize) -> RangeInclusive<Self> {
        Self::zero()..=Self::all_bits(n)
    }
}

pub struct BitIter<T> {
    cur: T,
    all: T,
    ended: bool,
}

impl<T: Copy> BitIter<T> {
    pub fn new(all: T) -> Self {
        Self {
            cur: all,
            all,
            ended: false,
        }
    }
}

impl<T: BitOps + Sub<Output = T>> Iterator for BitIter<T> {
    type Item = T;

    fn next(&mut self) -> Option<Self::Item> {
        if self.ended {
            return None;
        }
        let res = self.cur;
        if self.cur == T::zero() {
            self.ended = true;
        } else {
            self.cur = (self.cur - T::one()) & self.all;
        }
        Some(res)
    }
}

impl<
        T: Copy
            + BitAnd<Output = Self>
            + BitAndAssign
            + BitOr<Output = Self>
            + BitOrAssign
            + BitXor<Output = Self>
            + BitXorAssign
            + Not<Output = Self>
            + Shl<usize, Output = Self>
            + ShlAssign<usize>
            + Shr<usize, Output = Self>
            + ShrAssign<usize>
            + One
            + Zero
            + PartialEq,
    > BitOps for T
{
}

pub trait Bits: BitOps {
    fn bits() -> u32;
}

macro_rules! bits_integer_impl {
    ($($t: ident $bits: expr),+) => {$(
        impl Bits for $t {
            fn bits() -> u32 {
                $bits
            }
        }
    )+};
}

bits_integer_impl!(i128 128, i64 64, i32 32, i16 16, i8 8, isize 64, u128 128, u64 64, u32 32, u16 16, u8 8, usize 64);
}
pub mod invertible {
pub trait Invertible {
    type Output;

    fn inv(&self) -> Option<Self::Output>;
}
}
}
}
}
fn main() {
    let mut sin = std::io::stdin();
    let input = algo_lib::io::input::Input::new(&mut sin);
    let mut stdout = std::io::stdout();
    let output = algo_lib::io::output::Output::new(&mut stdout);
    solution::run(input, output);
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 2236kb

input:

3 2 3
1 1
-1 3
1
2
3

output:

Yes
Yes
No

result:

ok 3 tokens

Test #2:

score: 0
Accepted
time: 0ms
memory: 2232kb

input:

3 2 3
1 1
-1 0
1
2
3

output:

No
No
No

result:

ok 3 tokens

Test #3:

score: 0
Accepted
time: 0ms
memory: 2032kb

input:

1 1 1
0 1000000000
-1000000000

output:

Yes

result:

ok "Yes"

Test #4:

score: 0
Accepted
time: 0ms
memory: 2164kb

input:

3 2 3
0 1000000000
1 -1000000000
-1000000000
0
-1000000000

output:

No
No
No

result:

ok 3 tokens

Test #5:

score: 0
Accepted
time: 142ms
memory: 23944kb

input:

50134 500000 500000
-154428638 -283522863
-186373509 -327130969
154999046 46750274
-933523447 349415487
-437683609 140099255
864996699 -262318199
811293034 -264299324
120273173 52410685
874944410 -52048424
445049930 -803690605
-138111276 -104634331
720288580 126597671
471164416 -348777147
-356502322...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #6:

score: 0
Accepted
time: 164ms
memory: 30304kb

input:

100848 500000 500000
720352587 361776806
231853504 -933882325
960971230 -83519300
-152772415 -631132247
842871215 -666621297
857194330 -754943024
-698506963 -705416545
-3551931 -927937446
628710320 -942247987
674921043 847145884
-325629529 475694308
-339363446 686789318
236702996 654762989
420412365...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Y...

result:

ok 500000 tokens

Test #7:

score: 0
Accepted
time: 185ms
memory: 37308kb

input:

150017 500000 500000
-421117558 -111455068
-339650079 -834968786
-41718919 419434475
-574669254 477810078
-208090630 898829660
960273942 388265109
-125813433 327374640
360078728 -43670454
325384591 -821490639
180403987 -234797747
-66837706 246624381
691417200 -488557843
-12157264 809720468
-27690539...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #8:

score: 0
Accepted
time: 229ms
memory: 44172kb

input:

200806 500000 500000
-258823842 -746938452
767141873 239212613
-636327282 608642297
32878678 -599637555
-886750171 266284414
-305571379 -530753894
-479699957 -314474638
-314368519 891752869
-532306854 949604876
-786780332 924096014
881624655 -427208447
-828777932 982410017
-993666003 -964783795
4739...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes...

result:

ok 500000 tokens

Test #9:

score: 0
Accepted
time: 269ms
memory: 53208kb

input:

250967 500000 500000
-259603037 -147096086
-522981205 -196517864
-381078674 -71123846
-855834769 247956205
141305563 -185585163
733025073 -330336665
-229023675 23759681
74736395 20184402
-670373808 -63240239
-334376006 -287990431
-465875753 583301785
964517056 1580583
-855645538 -487116442
-65247474...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #10:

score: 0
Accepted
time: 305ms
memory: 65180kb

input:

300375 500000 500000
793181826 -619804723
-986427452 134261865
437562931 -794737754
-521408178 -508399450
606976759 277928484
-519111960 -227118711
153586118 -586261112
-508917435 -466941695
249860836 -422755184
-126335863 519019663
645935801 -107887022
-924300803 48366918
-355121282 -13333421
-1403...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #11:

score: 0
Accepted
time: 303ms
memory: 69880kb

input:

350925 500000 500000
-505116063 -14955865
116307759 490825592
484543615 734519563
-445218662 -80035005
-85982781 420310805
-592881015 849216294
406362727 -484878521
-718889987 282061741
865119022 -903485039
240534334 517849261
-278659735 202074249
788989155 291446892
683706893 -217476533
-23842796 -...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #12:

score: 0
Accepted
time: 319ms
memory: 83932kb

input:

400332 500000 500000
210979212 921953317
537984085 413101400
-310977739 691376942
-529333435 -633585426
-702242668 -43566580
839211888 171095937
-900909292 -542358581
-472744611 688276055
-92863103 -344038836
433433147 -877216111
131846069 535061672
120212750 -64810598
-157310367 -49897435
-66055325...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #13:

score: 0
Accepted
time: 358ms
memory: 88160kb

input:

450502 500000 500000
934366003 713833231
-540537783 -772635744
-870362457 961906861
-315213829 895720681
-995660268 362545063
604723842 -591393639
69650285 76559281
178342063 -488026178
290327421 993186557
897378017 -354451014
503855556 -51363291
607948528 -686514463
-250166052 850204811
732450917 -...

output:

No
No
No
No
Yes
No
No
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
No
No
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
Yes
Yes
No
No
No
No
Yes
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
No
No
No
...

result:

ok 500000 tokens

Test #14:

score: 0
Accepted
time: 393ms
memory: 94160kb

input:

500000 500000 500000
966727472 -987262600
-941363268 -448851405
497369401 -763175430
-521570723 -253137495
-59377674 897084162
-927697680 194938645
-320567520 972947173
-759580625 -891939724
440664363 -708397721
-106076187 133189095
-227693306 951433983
-840614153 -916214122
345203489 -805213532
323...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No...

result:

ok 500000 tokens

Test #15:

score: 0
Accepted
time: 115ms
memory: 23944kb

input:

50917 500000 500000
821600827 93833509
56797748 598817645
583504732 214722161
-55339678 92504491
916899089 507556350
21450234 57984110
-198214320 98038774
680851502 -8206439
-266344281 346375050
643803789 394525320
-314320721 -65866795
318481960 528502622
605064382 779435269
950839756 629408126
-915...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #16:

score: 0
Accepted
time: 178ms
memory: 30236kb

input:

100412 500000 500000
260708565 109118293
-426206308 -670881010
937079489 -630991882
-88050539 799213111
-834122755 -732831969
640334341 868469248
857773716 167614085
-742487759 -154717215
-319410322 -353140251
477841328 645036789
86657593 252754672
-675736929 526032304
558005818 -813645833
476156955...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 500000 tokens

Test #17:

score: 0
Accepted
time: 214ms
memory: 37392kb

input:

150943 500000 500000
-82263839 -926116011
370575802 748737234
992744345 -45459045
334688681 -825779321
-879362808 8225986
-166284992 442612395
-27890128 599023904
-917738679 -100625326
-838611563 -526580668
-207776092 -281725854
-878833367 -157637069
-52872009 54093239
873933192 377740391
108913170 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #18:

score: 0
Accepted
time: 236ms
memory: 44124kb

input:

200083 500000 500000
-54990989 -316306537
-722871431 650278699
297569836 622813331
758555918 869527332
-300841029 616675797
593526500 -132026204
666303319 353977562
293965254 731607735
-987109920 -541930678
180180177 377745646
-255569717 384422695
282117110 288059115
184111720 190371958
633686732 60...

output:

No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Y...

result:

ok 500000 tokens

Test #19:

score: 0
Accepted
time: 285ms
memory: 52744kb

input:

250233 500000 500000
823069656 967683991
-40967466 -849487159
-368913615 221583560
-748183039 -285990821
-481352159 88821413
-511734771 161137543
451769842 407838397
577947892 -531812156
-129079497 -543712420
-812665179 972071771
513536391 24084320
622839150 766003602
-710856110 48542131
-292051893 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #20:

score: 0
Accepted
time: 313ms
memory: 66508kb

input:

300736 500000 500000
340623218 441079804
-672514415 -63727739
550430618 -427707155
-742474654 -176880297
-409700288 -903855580
-255415650 298337294
330907695 -846104249
121695310 27948432
-734702182 197867873
-943141817 -980961600
-119618881 -815496779
744346570 -42979562
-797372721 504325032
-63482...

output:

Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Y...

result:

ok 500000 tokens

Test #21:

score: 0
Accepted
time: 331ms
memory: 69816kb

input:

350639 500000 500000
-749009333 -361640878
317730758 496109183
713329514 256369084
-937876314 399056867
-991960576 -176664720
149717099 -919753068
802295501 670641414
-686898455 -312994272
-569137944 219115432
-230037985 148292785
-964749345 -644048432
541657926 -936486385
562993023 -570177482
-6496...

output:

Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
No
Yes
No
Yes
Yes
Yes
Yes
No
No
No
No
No
Yes
No
Yes
No
No
Yes
No
No
Yes
...

result:

ok 500000 tokens

Test #22:

score: 0
Accepted
time: 380ms
memory: 83948kb

input:

400788 500000 500000
933565340 390955203
-449859846 -148424809
663276741 -658193290
-14080776 813282014
-668685011 744954159
-856881563 309577890
474832670 693677168
568237581 226824982
147551828 690252290
395012296 855681295
2628144 340488538
-31647675 -33694795
-228766558 -836955166
901437392 2638...

output:

No
Yes
Yes
No
No
No
Yes
Yes
No
No
Yes
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
Yes
No
Yes
No
No
No
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
No
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
No
No
No
Yes
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
Yes
Yes
Yes
No
Yes
Yes
No
No
No
No
No
Yes
No
Yes
Yes
Yes
No
Yes
No...

result:

ok 500000 tokens

Test #23:

score: 0
Accepted
time: 376ms
memory: 89436kb

input:

450930 500000 500000
-651971095 -100710583
-51000766 239233025
-402361433 -515946884
-794473451 -743158512
-904540228 -11490775
-953983284 497158418
-835628542 -590823313
269621947 -290790038
707068999 458578066
988647061 -376257545
-989151568 115941893
-806466699 -716511506
858577450 734524359
-937...

output:

Yes
No
Yes
No
No
Yes
No
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
Yes
No
No
No
Yes
No
No
Yes
No
Yes
No
Yes
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
...

result:

ok 500000 tokens

Test #24:

score: 0
Accepted
time: 383ms
memory: 93812kb

input:

500000 500000 500000
377142918 -529644851
288209416 722058973
976126918 310312395
929108639 630475840
-60256981 294170246
408833967 -401330666
-541618462 62531486
892749704 -85928831
-362538141 -611788573
-131189282 264824491
46114414 -593787478
-79374927 -99610958
-58819544 792368626
-488765958 166...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #25:

score: 0
Accepted
time: 127ms
memory: 23840kb

input:

50134 500000 500000
-352909122 496809151
481417874 -76811311
200401781 -425361696
-154433056 -174299151
-186383895 340660856
154980917 561309778
-933539762 -95140224
-437675228 538842055
865010416 188364262
811310037 -425214958
120319866 34536051
874984452 911248727
445075396 -183011535
-138109441 -...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #26:

score: 0
Accepted
time: 178ms
memory: 30536kb

input:

100848 500000 500000
716274354 82017213
-8574560 178401448
463527728 166827314
-631561500 -107036719
568407084 256507759
225567558 224244043
-845202318 -497102617
-116920133 -707383906
-191686705 170136157
266393667 -566654585
-779948459 -495691794
42897256 198871410
41412153 73556562
239258235 1455...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #27:

score: 0
Accepted
time: 206ms
memory: 37120kb

input:

150017 500000 500000
-450582968 155291056
-693697031 8232536
-81318813 336656120
-512148964 -45751714
-680884151 -354043
-527550244 434911719
577364267 -248159676
-861333866 843565551
722890080 10546727
745418611 -250405204
-834560456 237698721
439675371 -280114665
-743335714 368548680
-969331851 38...

output:

No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
...

result:

ok 500000 tokens

Test #28:

score: 0
Accepted
time: 246ms
memory: 44288kb

input:

200806 500000 500000
265999703 -120057615
217980161 -526115196
-151237797 377548014
-900088933 -153337259
257767232 378163136
-661087896 -280971569
113868467 -495746411
-112062451 -730721644
362129572 56514741
111181567 63581425
-847509123 -145779056
-484791449 -89298993
300730031 285138721
82693627...

output:

Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes...

result:

ok 500000 tokens

Test #29:

score: 0
Accepted
time: 278ms
memory: 53528kb

input:

250967 500000 500000
478927673 -850638285
-588943940 244748571
-215993739 102988729
-464295691 540045919
767840390 453722663
-470432227 71404346
-320810097 -265590588
-212382885 -325327807
220565838 -529927227
27837565 -286495917
-975531115 -82503149
-126355395 -202894847
-541084317 696891063
838186...

output:

No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 500000 tokens

Test #30:

score: 0
Accepted
time: 296ms
memory: 64332kb

input:

300375 500000 500000
-117693267 604516861
-560371705 49581577
202389111 -358325152
-992040633 -275451846
398497603 -643914941
-813358195 -508446097
626896736 11441827
-876502421 158185925
86817473 -493465644
836395019 369280802
655357390 708068825
662954848 736351110
-880403232 -479205304
64084945 1...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #31:

score: 0
Accepted
time: 331ms
memory: 69664kb

input:

350925 500000 500000
-697194511 -282360183
36297062 -153783633
-997250039 158258386
-51425782 192929055
585907564 -562258732
-155453132 458224997
740858447 720090080
-857252782 -273899635
-925833071 -483060596
-655262390 -652897563
390024332 221459477
-128438597 612300665
-647523020 -326890838
-2848...

output:

No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
No
No
Yes
No
No
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
Yes
No
Yes
Yes
No
No
No
No
Yes
No
Yes
No
Yes
Yes
Yes
No
No
No
No
Yes
No
Yes
Yes
No
Yes
No
Yes
No
No
No
Yes
Yes
No
No
Yes
No
No
No
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
No
Yes
N...

result:

ok 500000 tokens

Test #32:

score: 0
Accepted
time: 360ms
memory: 82780kb

input:

400332 500000 500000
-577054503 -7243348
-728582287 -952430295
-14550186 -342788384
-401938518 -178354797
-270624515 749953900
-543784655 -224997521
-836378072 -404990740
-134174286 -7742614
-994125133 413536665
-869852925 -190575004
-88964538 275783353
-944793224 -694759066
569604176 -93198348
-901...

output:

Yes
Yes
Yes
No
No
No
No
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
Yes
No
No
Yes
No
No
No
No
No
Yes
No
Yes
No
No
No
No
Yes
No
No
No
No
Yes
No
Yes
No
No
No
Yes
No
No
No
No
No
Yes
Yes
No
Yes
No
No
No
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
Yes
No
No
Yes
No
N...

result:

ok 500000 tokens

Test #33:

score: 0
Accepted
time: 371ms
memory: 88860kb

input:

450502 500000 500000
174951506 511379844
744356696 138785326
-832754234 12184281
-411785069 358971924
-973632404 728358674
442337054 -502140791
567149272 -40165778
124413302 248350109
-573066650 305904281
302520279 45188900
-718597192 -144584506
167018119 412047115
340946717 -113421972
670265028 683...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
Yes
No
No...

result:

ok 500000 tokens

Test #34:

score: 0
Accepted
time: 398ms
memory: 93964kb

input:

500000 500000 500000
-862370905 -541057218
-563051036 253456082
513207566 240525433
30697708 -271168424
504298759 -547747462
615359632 -258687234
-106242714 348636467
847155031 -46332286
653598888 662545557
-302765388 -295948296
-80437588 -305236970
666150928 -77717441
920854012 -486886754
-91993898...

output:

No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No...

result:

ok 500000 tokens

Test #35:

score: 0
Accepted
time: 135ms
memory: 23940kb

input:

50917 500000 500000
-108779960 -470222501
-791827352 -813078866
-100584785 -420298096
-804215404 -173276674
-299808734 109882479
821616642 864314314
56814230 -134452191
583489392 -308791155
-55337054 107859870
916882376 -130116951
21451526 394150527
-198199960 -253294039
680823994 -145418783
-266345...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 500000 tokens

Test #36:

score: 0
Accepted
time: 172ms
memory: 30228kb

input:

100412 500000 500000
-488598928 137647395
-24338943 -740778974
156785480 -429293089
189071483 17236156
-845285565 -590559936
-98388647 -520230395
512051546 519650612
127957156 -299510969
-440828101 -678116702
-574706006 -221305381
-382963203 2797476
33419281 -276093731
-791353142 -220076598
26887190...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 500000 tokens

Test #37:

score: 0
Accepted
time: 194ms
memory: 37332kb

input:

150943 500000 500000
-808825710 -91947298
-428096645 -139050587
-781025622 -567166790
931271545 -840239616
622303161 304003882
80797919 72328827
-276542946 49372692
-34421692 148756141
-323398220 140918045
864793328 192173063
-682863120 -389532488
-237587283 -68624950
-955555274 -417680269
139860903...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #38:

score: 0
Accepted
time: 207ms
memory: 44100kb

input:

200083 500000 500000
-688409132 -111350572
5107414 -475249371
600226398 30126962
711345233 681681066
970406001 -329614969
-147366734 800726242
354920390 54276300
949511667 -584689753
-210684146 854620480
38022597 251935950
-560674276 -532014618
-65322382 -59181031
-285873050 150074062
808777042 1953...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Ye...

result:

ok 500000 tokens

Test #39:

score: 0
Accepted
time: 266ms
memory: 53212kb

input:

250233 500000 500000
-213806444 -132515305
33375182 304176282
-833681147 389229245
652900865 36676100
-383813599 166458978
500131614 -350865349
29788836 92903823
753313257 -255947096
-126733472 -251251146
421632494 800297194
349662780 -60433480
-884824107 231740571
272902797 109650597
-217674250 -11...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes...

result:

ok 500000 tokens

Test #40:

score: 0
Accepted
time: 300ms
memory: 64064kb

input:

300736 500000 500000
-630513241 -238053445
-398126734 356648381
233377425 -92370826
283265426 336258325
509413020 16560820
89499264 113801252
-768126578 65337880
275749307 -325705088
-287548673 447345828
-387379263 475470632
870952002 -163823509
880169923 307382799
-454712744 332806636
-265892282 32...

output:

Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No...

result:

ok 500000 tokens

Test #41:

score: 0
Accepted
time: 322ms
memory: 69852kb

input:

350639 500000 500000
983993797 -438847059
-226688471 151537074
-593104111 -615459490
131189348 -20913596
377999660 165108436
-113753429 243590952
-508101443 -651638462
-25604069 344429890
533933692 -212465349
219726817 -232645984
918020591 -300562704
619070045 230373327
-340620549 -107958131
-548472...

output:

Yes
No
No
Yes
Yes
No
No
No
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
No
No
No
Yes
No
No
Yes
No
No
Yes
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
No
No
No
Yes
Yes
Yes
No
Yes
No
No
No
Yes
Yes
...

result:

ok 500000 tokens

Test #42:

score: 0
Accepted
time: 370ms
memory: 84844kb

input:

400788 500000 500000
616437018 -177364929
-791825777 -5005483
-574160332 -132312417
524635811 -369956315
102755025 69613889
872397427 -6701625
120054055 -85403809
511673239 -45487652
-584723371 -771997552
-557724934 -169560627
367052900 74586989
108543818 221256170
103042279 -26526098
-949679791 -63...

output:

No
No
Yes
Yes
Yes
No
No
No
Yes
No
No
Yes
No
Yes
Yes
No
No
Yes
No
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
Yes
No
No
Yes
Yes
Yes
No
No
Yes
No
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
No
No
No
Yes
No
N...

result:

ok 500000 tokens

Test #43:

score: 0
Accepted
time: 373ms
memory: 88828kb

input:

450930 500000 500000
-863828355 -241625444
651938686 91810589
-283593622 -135874478
-678773941 -435510471
535236794 -19194073
64197067 -547168245
214415440 190115751
322130452 -372530145
725344218 487634283
735438090 -351177821
198784222 635724647
-720973816 178617513
-577419389 -225206248
21377185 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #44:

score: 0
Accepted
time: 388ms
memory: 93756kb

input:

500000 500000 500000
-941502127 -275321011
-780335671 504310641
-47615328 -768146234
967585681 -120060693
-786443725 -682794219
-539065052 409668578
-733817644 -378475580
160271020 -744666561
-191156013 571069553
-815365206 694020897
-775150148 400881042
-300999637 -78397014
452621321 418204581
7047...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #45:

score: 0
Accepted
time: 63ms
memory: 16964kb

input:

65536 66116 500000
-661462733 997139260
310493332 444667539
713970280 998160517
-209298264 998975646
149759475 998769452
948444759 997713562
967730315 -995496151
-951934279 998961069
490430027 946364701
-63036434 -977384357
780568120 998965164
-287530261 998980362
224975951 925989693
71855796 998996...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #46:

score: 0
Accepted
time: 63ms
memory: 16920kb

input:

65536 65970 500000
375041055 998946924
-554352389 998976282
820334322 994414522
839699599 998971130
-520319596 -941051239
162783220 997905213
666955304 -993969771
-901291561 -977012075
-116824769 998908951
-918392400 792616968
-340439247 998415665
946025654 998980026
104625711 985393293
966866919 99...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 500000 tokens

Test #47:

score: 0
Accepted
time: 66ms
memory: 16964kb

input:

65536 66138 500000
-786809034 -239265533
-784519187 -967620144
-536854571 -998951747
515130126 997293429
569059311 991871685
-574191867 998972497
7607826 980649009
-710308976 -998983944
-190672224 998744675
839136358 996106716
311563933 998951233
-873143252 998946661
966397953 998962138
-260396534 9...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 500000 tokens

Test #48:

score: 0
Accepted
time: 113ms
memory: 31856kb

input:

131072 154427 500000
367680056 -998853618
402844543 738002768
685248182 -348621463
-922981732 997593637
753563346 -995842238
-696191312 -998914570
-485717901 -661027006
239867439 -998747022
-447994320 998926709
85885797 996633947
899975414 -998831675
39111708 998718708
50761182 -998872787
-20509495 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #49:

score: 0
Accepted
time: 110ms
memory: 32088kb

input:

131072 154745 500000
463348260 998978406
-931543322 -998892948
132632768 998267185
965789029 -169765580
-488592144 998937750
-541664223 -980949265
-388653830 998744910
35906273 229649352
-425051874 998935616
22214402 -714650124
801864299 984360600
80281750 -995496769
101263130 -998924913
-962773696 ...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Ye...

result:

ok 500000 tokens

Test #50:

score: 0
Accepted
time: 138ms
memory: 31912kb

input:

131072 155158 500000
313411942 969710867
984182273 993779667
-481809479 998994973
303026701 998604209
-515591712 -996130662
327653318 998824945
684311718 998658214
522739252 825698213
-703486699 -954198892
-170101453 998897020
-260413921 998996930
-857202158 998988697
-466947656 -467135779
878622527...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Y...

result:

ok 500000 tokens

Test #51:

score: 0
Accepted
time: 256ms
memory: 62908kb

input:

262144 468022 500000
507180973 -194015033
261216288 124134093
580583690 0
-253599489 -998630949
14251016 -998620459
-675450499 0
-997394601 764416525
954820605 511271879
255970163 0
546532303 436603108
-944832141 -998838083
476432362 998352353
-115041742 998749596
700437383 -542209787
-572212911 -54...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 500000 tokens

Test #52:

score: 0
Accepted
time: 286ms
memory: 63168kb

input:

262144 464372 500000
752541632 963608330
-98153807 173644117
-951896842 -290330180
555989826 0
369704325 -394276816
900011632 129904533
-985163590 585014538
197342950 0
637531423 -998976285
-674886985 -628457723
744681524 -998724823
602970571 -177824966
-720095388 0
-355800874 0
-961881615 -74518991...

output:

No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
Ye...

result:

ok 500000 tokens

Test #53:

score: 0
Accepted
time: 274ms
memory: 65224kb

input:

262144 466224 500000
965872212 0
-825778766 -368530975
175762732 998774496
276756201 -434786140
587510596 -883391959
-337583260 0
-208972056 -385485886
-726270537 -918050831
-518564908 303822630
-207951930 964975476
910466325 771304975
-45854860 -998680736
269618487 676640484
-543747381 -985216485
-...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
No
Yes
Yes
No
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Y...

result:

ok 500000 tokens

Test #54:

score: 0
Accepted
time: 29ms
memory: 30636kb

input:

100000 199998 1
0 100001
0 1
1 100001
1 1
2 100001
2 1
3 100001
3 1
4 100001
4 1
5 100001
5 1
6 100001
6 1
7 100001
7 1
8 100001
8 1
9 100001
9 1
10 100001
10 1
11 100001
11 1
12 100001
12 1
13 100001
13 1
14 100001
14 1
15 100001
15 1
16 100001
16 1
17 100001
17 1
18 100001
18 1
19 100001
19 1
20 1...

output:

No

result:

ok "No"

Extra Test:

score: 0
Extra Test Passed