QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#231026 | #7645. Shoes | ucup-team296# | AC ✓ | 1649ms | 4172kb | Rust | 29.5kb | 2023-10-28 23:22:38 | 2023-10-28 23:22:38 |
Judging History
answer
pub mod solution {
//{"name":"n","group":"Manual","url":"","interactive":false,"timeLimit":2000,"tests":[{"input":"","output":""}],"testType":"single","input":{"type":"stdin","fileName":null,"pattern":null},"output":{"type":"stdout","fileName":null,"pattern":null},"languages":{"java":{"taskClass":"n"}}}
use crate::algo_lib::collections::array_2d::Array2D;
use crate::algo_lib::io::output::output;
use crate::algo_lib::io::task_io_settings::TaskIoType;
use crate::algo_lib::io::task_runner::run_task;
use crate::algo_lib::io::input::Input;
use crate::algo_lib::io::task_io_settings::TaskIoSettings;
use crate::algo_lib::misc::rand::Random;
#[allow(unused)]
use crate::dbg;
use crate::out;
use crate::out_line;
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
struct State {
used_days: i64,
inside_day: i64,
}
fn solve_fast(a: &[i64], one_try: i64, one_day: i64) -> i64 {
let n = a.len();
let mut dp = Array2D::new(
State {
used_days: i64::MAX / 2,
inside_day: 0,
},
4,
1,
);
dp[0][0] = State {
used_days: 1,
inside_day: 0,
};
for len in (1..=n).rev() {
let mut ndp = Array2D::new(
State {
used_days: i64::MAX / 2,
inside_day: 0,
},
4,
dp[0].len() + 1,
);
for l in 0..dp[0].len() {
let r = l + len - 1;
for mask in 0..4 {
// dbg!(mask, l, r, dp[mask][l]);
for i in 0..2 {
let pos = if i == 0 { l } else { r };
let need_time = a[pos].abs();
let mut nmask = mask;
let mut new_state = dp[mask][l];
if ((1 << i) & mask) == 0 {
if new_state.inside_day + need_time <= one_day {
new_state.inside_day += need_time;
nmask |= 1 << i;
} else {
new_state.inside_day = need_time;
new_state.used_days += 1;
nmask = 1 << i;
}
}
if new_state.inside_day + one_try <= one_day {
new_state.inside_day += one_try;
} else {
new_state.used_days += 1;
new_state.inside_day = one_try + need_time;
nmask = 1 << i;
}
if i == 0 {
if a[pos] <= 0 {
if ndp[nmask][l + 1] > new_state {
ndp[nmask][l + 1] = new_state;
}
}
} else if ndp[nmask][l] > new_state {
if a[pos] >= 0 {
ndp[nmask][l] = new_state;
}
}
}
}
}
dp = ndp;
}
let mut res = State {
used_days: i64::MAX / 2,
inside_day: 0,
};
for mask in 0..4 {
for l in 0..dp[0].len() {
res = res.min(dp[mask][l]);
}
}
res.used_days
}
fn solve_slow(a: &[i64], one_try: i64, one_day: i64) -> i64 {
let n = a.len();
let mut dp = vec![i64::MAX; 1 << n];
dp[0] = 0;
for mask in 0..(1 << n) {
for more_mask in 0usize..(1 << n) {
let next_mask = mask | more_mask;
let mut max_a = 0;
let mut min_a = 0;
for v in 0..n {
if ((1 << v) & more_mask) != 0 {
max_a = max_a.max(a[v]);
min_a = min_a.min(a[v]);
}
}
let mut cost = (more_mask).count_ones() as i64 * one_try;
cost += max_a;
cost += min_a.abs();
if cost <= one_day {
dp[next_mask] = dp[next_mask].min(dp[mask] + 1);
}
}
}
dp[dp.len() - 1]
}
fn stress() {
for t in 23.. {
dbg!(t);
let mut rnd = Random::new(t);
let n = rnd.gen(1..10);
let max_sz = rnd.gen(1..10);
let mut a: Vec<i64> = vec![];
for _ in 0..n {
a.push(rnd.gen(-max_sz..max_sz));
}
a.sort();
let one_try = rnd.gen(1..10);
let mut one_day = rnd.gen(1..20);
for &x in a.iter() {
one_day = one_day.max(x.abs() + one_try);
}
let my = solve_fast(&a, one_try, one_day);
let slow = solve_slow(&a, one_try, one_day);
if my != slow {
dbg!(my, slow, a, one_try, one_day);
}
assert_eq!(my, slow);
}
}
fn solve(input: &mut Input, _test_case: usize) {
let n = input.usize();
let one_try = input.i64();
let one_day = input.i64();
let mut a = input.vec::<i64>(n);
a.sort();
for x in a.iter_mut() {
*x *= 2;
}
let res = solve_fast(&a, one_try, one_day);
out_line!(res);
}
pub(crate) fn run(mut input: Input) -> bool {
solve(&mut input, 1);
output().flush();
true
}
#[allow(unused)]
pub fn submit() -> bool {
let io = TaskIoSettings {
is_interactive: false,
input: TaskIoType::Std,
output: TaskIoType::Std,
};
run_task(io, run)
}
}
pub mod algo_lib {
pub mod collections {
pub mod array_2d {
use crate::algo_lib::io::output::Output;
use crate::algo_lib::io::output::Writable;
use crate::algo_lib::misc::num_traits::Number;
use std::io::Write;
use std::ops::Index;
use std::ops::IndexMut;
use std::ops::Mul;
// TODO: implement good Debug
#[derive(Clone, Debug)]
pub struct Array2D<T> {
rows: usize,
cols: usize,
v: Vec<T>,
}
pub struct Iter<'a, T> {
array: &'a Array2D<T>,
row: usize,
col: usize,
}
impl<T> Array2D<T>
where
T: Clone,
{
#[allow(unused)]
pub fn new(empty: T, rows: usize, cols: usize) -> Self {
Self {
rows,
cols,
v: vec![empty; rows * cols],
}
}
pub fn new_f(rows: usize, cols: usize, mut f: impl FnMut(usize, usize) -> T) -> Self {
let mut v = Vec::with_capacity(rows * cols);
for r in 0..rows {
for c in 0..cols {
v.push(f(r, c));
}
}
Self { rows, cols, v }
}
pub fn rows(&self) -> usize {
self.rows
}
#[allow(clippy::len_without_is_empty)]
pub fn len(&self) -> usize {
self.rows()
}
pub fn cols(&self) -> usize {
self.cols
}
pub fn swap(&mut self, row1: usize, row2: usize) {
assert!(row1 < self.rows);
assert!(row2 < self.rows);
if row1 != row2 {
for col in 0..self.cols {
self.v.swap(row1 * self.cols + col, row2 * self.cols + col);
}
}
}
pub fn transpose(&self) -> Self {
Self::new_f(self.cols, self.rows, |r, c| self[c][r].clone())
}
pub fn iter(&self) -> Iter<T> {
Iter {
array: self,
row: 0,
col: 0,
}
}
pub fn pref_sum(&self) -> Self
where
T: Number,
{
let mut res = Self::new(T::ZERO, self.rows + 1, self.cols + 1);
for i in 0..self.rows {
for j in 0..self.cols {
let value = self[i][j] + res[i][j + 1] + res[i + 1][j] - res[i][j];
res[i + 1][j + 1] = value;
}
}
res
}
}
impl<T> Writable for Array2D<T>
where
T: Writable,
{
fn write(&self, output: &mut Output) {
for r in 0..self.rows {
self[r].write(output);
output.write_all(&[b'\n']).unwrap();
}
}
}
impl<T> Index<usize> for Array2D<T> {
type Output = [T];
fn index(&self, index: usize) -> &Self::Output {
&self.v[(index) * self.cols..(index + 1) * self.cols]
}
}
impl<T> IndexMut<usize> for Array2D<T> {
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
&mut self.v[(index) * self.cols..(index + 1) * self.cols]
}
}
impl<T> Mul for &Array2D<T>
where
T: Number,
{
type Output = Array2D<T>;
fn mul(self, rhs: Self) -> Self::Output {
let n = self.rows;
let m = self.cols;
assert_eq!(m, rhs.rows);
let k2 = rhs.cols;
let mut res = Array2D::new(T::ZERO, n, k2);
for i in 0..n {
for j in 0..m {
for k in 0..k2 {
res[i][k] += self[i][j] * rhs[j][k];
}
}
}
res
}
}
impl<T> Array2D<T>
where
T: Number,
{
pub fn pown(&self, pw: usize) -> Self {
assert_eq!(self.rows, self.cols);
let n = self.rows;
if pw == 0 {
Self::new_f(n, n, |r, c| if r == c { T::ONE } else { T::ZERO })
} else if pw == 1 {
self.clone()
} else {
let half = self.pown(pw / 2);
let half2 = &half * ½
if pw & 1 == 0 {
half2
} else {
&half2 * self
}
}
}
}
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<Self::Item> {
if self.col == self.array.cols {
self.col = 0;
self.row += 1;
}
if self.row >= self.array.rows {
return None;
}
let elem = &self.array[self.row][self.col];
self.col += 1;
Some(elem)
}
}
}
}
pub mod io {
pub mod input {
use std::fmt::Debug;
use std::io::Read;
use std::marker::PhantomData;
use std::path::Path;
use std::str::FromStr;
pub struct Input {
input: Box<dyn Read>,
buf: Vec<u8>,
at: usize,
buf_read: usize,
}
macro_rules! read_integer_fun {
($t:ident) => {
#[allow(unused)]
pub fn $t(&mut self) -> $t {
self.read_integer()
}
};
}
impl Input {
const DEFAULT_BUF_SIZE: usize = 4096;
///
/// Using with stdin:
/// ```no_run
/// use algo_lib::io::input::Input;
/// let stdin = std::io::stdin();
/// let input = Input::new(Box::new(stdin));
/// ```
///
/// For read files use ``new_file`` instead.
///
///
pub fn new(input: Box<dyn Read>) -> Self {
Self {
input,
buf: vec![0; Self::DEFAULT_BUF_SIZE],
at: 0,
buf_read: 0,
}
}
pub fn new_file<P: AsRef<Path>>(path: P) -> Self {
let file = std::fs::File::open(&path)
.unwrap_or_else(|_| panic!("Can't open file: {:?}", path.as_ref().as_os_str()));
Self::new(Box::new(file))
}
pub fn new_with_size(input: Box<dyn Read>, buf_size: usize) -> Self {
Self {
input,
buf: vec![0; buf_size],
at: 0,
buf_read: 0,
}
}
pub fn new_file_with_size<P: AsRef<Path>>(path: P, buf_size: usize) -> Self {
let file = std::fs::File::open(&path)
.unwrap_or_else(|_| panic!("Can't open file: {:?}", path.as_ref().as_os_str()));
Self::new_with_size(Box::new(file), buf_size)
}
pub fn get(&mut self) -> Option<u8> {
if self.refill_buffer() {
let res = self.buf[self.at];
self.at += 1;
Some(res)
} else {
None
}
}
pub fn peek(&mut self) -> Option<u8> {
if self.refill_buffer() {
Some(self.buf[self.at])
} else {
None
}
}
pub fn skip_whitespace(&mut self) {
while let Some(b) = self.peek() {
if !char::from(b).is_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 char::from(c).is_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()
}
pub fn has_more_elements(&mut self) -> bool {
!self.is_exhausted()
}
pub fn read<T: Readable>(&mut self) -> T {
T::read(self)
}
pub fn vec<T: Readable>(&mut self, size: usize) -> Vec<T> {
let mut res = Vec::with_capacity(size);
for _ in 0usize..size {
res.push(self.read());
}
res
}
pub fn string_vec(&mut self, size: usize) -> Vec<Vec<u8>> {
let mut res = Vec::with_capacity(size);
for _ in 0usize..size {
res.push(self.string());
}
res
}
pub fn read_line(&mut self) -> String {
let mut res = String::new();
while let Some(c) = self.get() {
if c == b'\n' {
break;
}
if c == b'\r' {
if self.peek() == Some(b'\n') {
self.get();
}
break;
}
res.push(c.into());
}
res
}
#[allow(clippy::should_implement_trait)]
pub fn into_iter<T: Readable>(self) -> InputIterator<T> {
InputIterator {
input: self,
phantom: Default::default(),
}
}
fn read_integer<T: FromStr>(&mut self) -> T
where
<T as FromStr>::Err: Debug,
{
let res = self.read_string();
res.parse::<T>().unwrap()
}
fn read_string(&mut self) -> String {
match self.next_token() {
None => {
panic!("Input exhausted");
}
Some(res) => unsafe { String::from_utf8_unchecked(res) },
}
}
pub fn string_as_string(&mut self) -> String {
self.read_string()
}
pub fn string(&mut self) -> Vec<u8> {
self.read_string().into_bytes()
}
fn read_char(&mut self) -> char {
self.skip_whitespace();
self.get().unwrap().into()
}
fn read_float(&mut self) -> f64 {
self.read_string().parse().unwrap()
}
pub fn f64(&mut self) -> f64 {
self.read_float()
}
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
}
}
read_integer_fun!(i32);
read_integer_fun!(i64);
read_integer_fun!(i128);
read_integer_fun!(u32);
read_integer_fun!(u64);
read_integer_fun!(usize);
}
pub trait Readable {
fn read(input: &mut Input) -> Self;
}
impl Readable for String {
fn read(input: &mut Input) -> Self {
input.read_string()
}
}
impl Readable for char {
fn read(input: &mut Input) -> Self {
input.read_char()
}
}
impl Readable for f64 {
fn read(input: &mut Input) -> Self {
input.read_string().parse().unwrap()
}
}
impl Readable for f32 {
fn read(input: &mut Input) -> Self {
input.read_string().parse().unwrap()
}
}
impl<T: Readable> Readable for Vec<T> {
fn read(input: &mut Input) -> Self {
let size = input.read();
input.vec(size)
}
}
pub struct InputIterator<T: Readable> {
input: Input,
phantom: PhantomData<T>,
}
impl<T: Readable> Iterator for InputIterator<T> {
type Item = T;
fn next(&mut self) -> Option<Self::Item> {
self.input.skip_whitespace();
self.input.peek().map(|_| self.input.read())
}
}
macro_rules! read_integer {
($t:ident) => {
impl Readable for $t {
fn read(input: &mut Input) -> Self {
input.read_integer()
}
}
};
}
read_integer!(i8);
read_integer!(i16);
read_integer!(i32);
read_integer!(i64);
read_integer!(i128);
read_integer!(isize);
read_integer!(u8);
read_integer!(u16);
read_integer!(u32);
read_integer!(u64);
read_integer!(u128);
read_integer!(usize);
}
pub mod output {
use std::io::Write;
pub struct Output {
output: Box<dyn Write>,
buf: Vec<u8>,
at: usize,
auto_flush: bool,
}
impl Output {
const DEFAULT_BUF_SIZE: usize = 4096;
pub fn new(output: Box<dyn Write>) -> Self {
Self {
output,
buf: vec![0; Self::DEFAULT_BUF_SIZE],
at: 0,
auto_flush: false,
}
}
pub fn new_with_auto_flush(output: Box<dyn Write>) -> Self {
Self {
output,
buf: vec![0; Self::DEFAULT_BUF_SIZE],
at: 0,
auto_flush: true,
}
}
pub fn flush(&mut self) {
if self.at != 0 {
self.output.write_all(&self.buf[..self.at]).unwrap();
self.at = 0;
self.output.flush().expect("Couldn't flush output");
}
}
pub fn print<T: Writable>(&mut self, s: &T) {
s.write(self);
}
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]) {
for i in arg {
i.write(self);
self.put(b'\n');
}
}
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_iter_ref<'a, T: 'a + Writable, I: Iterator<Item = &'a T>>(&mut self, iter: I) {
let mut first = true;
for e in iter {
if first {
first = false;
} else {
self.put(b' ');
}
e.write(self);
}
}
}
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;
}
if self.auto_flush {
self.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<T: Writable> Writable for [T] {
fn write(&self, output: &mut Output) {
output.print_iter_ref(self.iter());
}
}
impl<T: Writable> Writable for Vec<T> {
fn write(&self, output: &mut Output) {
self[..].write(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!(u8);
write_to_string!(u16);
write_to_string!(u32);
write_to_string!(u64);
write_to_string!(u128);
write_to_string!(usize);
write_to_string!(i8);
write_to_string!(i16);
write_to_string!(i32);
write_to_string!(i64);
write_to_string!(i128);
write_to_string!(isize);
write_to_string!(f32);
write_to_string!(f64);
impl<T: Writable, U: Writable> Writable for (T, U) {
fn write(&self, output: &mut Output) {
self.0.write(output);
output.put(b' ');
self.1.write(output);
}
}
impl<T: Writable, U: Writable, V: Writable> Writable for (T, U, V) {
fn write(&self, output: &mut Output) {
self.0.write(output);
output.put(b' ');
self.1.write(output);
output.put(b' ');
self.2.write(output);
}
}
pub static mut OUTPUT: Option<Output> = None;
pub fn set_global_output_to_stdout() {
unsafe {
OUTPUT = Some(Output::new(Box::new(std::io::stdout())));
}
}
pub fn set_global_output_to_file(path: &str) {
unsafe {
let out_file =
std::fs::File::create(path).unwrap_or_else(|_| panic!("Can't create file {}", path));
OUTPUT = Some(Output::new(Box::new(out_file)));
}
}
pub fn set_global_output_to_none() {
unsafe {
match &mut OUTPUT {
None => {}
Some(output) => output.flush(),
}
OUTPUT = None;
}
}
pub fn output() -> &'static mut Output {
unsafe {
match &mut OUTPUT {
None => {
panic!("Global output wasn't initialized");
}
Some(output) => output,
}
}
}
#[macro_export]
macro_rules! out {
($first: expr $(,$args:expr )*) => {
output().print(&$first);
$(output().put(b' ');
output().print(&$args);
)*
output().maybe_flush();
}
}
#[macro_export]
macro_rules! out_line {
($first: expr $(, $args:expr )* ) => {
{
out!($first $(,$args)*);
output().put(b'\n');
output().maybe_flush();
}
};
() => {
{
output().put(b'\n');
output().maybe_flush();
}
};
}
}
pub mod task_io_settings {
pub enum TaskIoType {
Std,
File(String),
}
pub struct TaskIoSettings {
pub is_interactive: bool,
pub input: TaskIoType,
pub output: TaskIoType,
}
}
pub mod task_runner {
use std::io::Write;
use super::input::Input;
use super::output::Output;
use super::output::OUTPUT;
use super::task_io_settings::TaskIoSettings;
use super::task_io_settings::TaskIoType;
pub fn run_task<Res>(io: TaskIoSettings, run: impl FnOnce(Input) -> Res) -> Res {
let output: Box<dyn Write> = match io.output {
TaskIoType::Std => Box::new(std::io::stdout()),
TaskIoType::File(file) => {
let out_file = std::fs::File::create(file).unwrap();
Box::new(out_file)
}
};
unsafe {
OUTPUT = Some(Output::new(output));
}
let input = match io.input {
TaskIoType::Std => {
let sin = std::io::stdin();
Input::new(Box::new(sin))
}
TaskIoType::File(file) => Input::new_file(file),
};
run(input)
}
}
}
pub mod misc {
pub mod dbg_macro {
#[macro_export]
#[allow(unused_macros)]
macro_rules! dbg {
($first_val:expr, $($val:expr),+ $(,)?) => {
eprint!("[{}:{}] {} = {:?}",
file!(), line!(), stringify!($first_val), &$first_val);
($(eprint!(", {} = {:?}", stringify!($val), &$val)),+,);
eprintln!();
};
($first_val:expr) => {
eprintln!("[{}:{}] {} = {:?}",
file!(), line!(), stringify!($first_val), &$first_val)
};
}
}
pub mod gen_vector {
pub fn gen_vec<T>(n: usize, f: impl FnMut(usize) -> T) -> Vec<T> {
(0..n).map(f).collect()
}
}
pub mod num_traits {
use std::cmp::Ordering;
use std::fmt::Debug;
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::Sub;
use std::ops::SubAssign;
pub trait HasConstants<T> {
const MAX: T;
const MIN: T;
const ZERO: T;
const ONE: T;
const TWO: T;
}
pub trait ConvSimple<T> {
fn from_i32(val: i32) -> T;
fn to_i32(self) -> i32;
fn to_f64(self) -> f64;
}
pub trait Signum {
fn signum(&self) -> i32;
}
pub trait Number:
Copy
+ Add<Output = Self>
+ AddAssign
+ Sub<Output = Self>
+ SubAssign
+ Mul<Output = Self>
+ MulAssign
+ Div<Output = Self>
+ DivAssign
+ PartialOrd
+ PartialEq
+ HasConstants<Self>
+ Default
+ Debug
+ Sized
+ ConvSimple<Self>
{
}
impl<
T: Copy
+ Add<Output = Self>
+ AddAssign
+ Sub<Output = Self>
+ SubAssign
+ Mul<Output = Self>
+ MulAssign
+ Div<Output = Self>
+ DivAssign
+ PartialOrd
+ PartialEq
+ HasConstants<Self>
+ Default
+ Debug
+ Sized
+ ConvSimple<Self>,
> Number for T
{
}
macro_rules! has_constants_impl {
($t: ident) => {
impl HasConstants<$t> for $t {
// TODO: remove `std` for new rust version..
const MAX: $t = std::$t::MAX;
const MIN: $t = std::$t::MIN;
const ZERO: $t = 0;
const ONE: $t = 1;
const TWO: $t = 2;
}
impl ConvSimple<$t> for $t {
fn from_i32(val: i32) -> $t {
val as $t
}
fn to_i32(self) -> i32 {
self as i32
}
fn to_f64(self) -> f64 {
self as f64
}
}
};
}
has_constants_impl!(i32);
has_constants_impl!(i64);
has_constants_impl!(i128);
has_constants_impl!(u32);
has_constants_impl!(u64);
has_constants_impl!(u128);
has_constants_impl!(usize);
has_constants_impl!(u8);
impl ConvSimple<Self> for f64 {
fn from_i32(val: i32) -> Self {
val as f64
}
fn to_i32(self) -> i32 {
self as i32
}
fn to_f64(self) -> f64 {
self
}
}
impl HasConstants<Self> for f64 {
const MAX: Self = Self::MAX;
const MIN: Self = -Self::MAX;
const ZERO: Self = 0.0;
const ONE: Self = 1.0;
const TWO: Self = 2.0;
}
impl<T: Number + Ord> Signum for T {
fn signum(&self) -> i32 {
match self.cmp(&T::ZERO) {
Ordering::Greater => 1,
Ordering::Less => -1,
Ordering::Equal => 0,
}
}
}
}
pub mod rand {
use crate::algo_lib::misc::gen_vector::gen_vec;
use crate::algo_lib::misc::num_traits::Number;
use std::ops::Range;
use std::time::SystemTime;
use std::time::UNIX_EPOCH;
#[allow(dead_code)]
pub struct Random {
state: u64,
}
impl Random {
pub fn gen_u64(&mut self) -> u64 {
let mut x = self.state;
x ^= x << 13;
x ^= x >> 7;
x ^= x << 17;
self.state = x;
x
}
#[allow(dead_code)]
pub fn next_in_range(&mut self, from: usize, to: usize) -> usize {
assert!(from < to);
(from as u64 + self.gen_u64() % ((to - from) as u64)) as usize
}
pub fn gen_index<T>(&mut self, a: &[T]) -> usize {
self.gen(0..a.len())
}
#[allow(dead_code)]
#[inline(always)]
pub fn gen_double(&mut self) -> f64 {
(self.gen_u64() as f64) / (std::usize::MAX as f64)
}
#[allow(dead_code)]
pub fn new(seed: u64) -> Self {
let state = if seed == 0 { 787788 } else { seed };
Self { state }
}
pub fn new_time_seed() -> Self {
let time = SystemTime::now();
let seed = (time.duration_since(UNIX_EPOCH).unwrap().as_nanos() % 1_000_000_000) as u64;
if seed == 0 {
Self::new(787788)
} else {
Self::new(seed)
}
}
#[allow(dead_code)]
pub fn gen_permutation(&mut self, n: usize) -> Vec<usize> {
let mut result: Vec<_> = (0..n).collect();
for i in 0..n {
let idx = self.next_in_range(0, i + 1);
result.swap(i, idx);
}
result
}
pub fn shuffle<T>(&mut self, a: &mut [T]) {
for i in 1..a.len() {
a.swap(i, self.gen(0..i + 1));
}
}
pub fn gen<T>(&mut self, range: Range<T>) -> T
where
T: Number,
{
let from = T::to_i32(range.start);
let to = T::to_i32(range.end);
assert!(from < to);
let len = (to - from) as usize;
T::from_i32(self.next_in_range(0, len) as i32 + from)
}
pub fn gen_vec<T>(&mut self, n: usize, range: Range<T>) -> Vec<T>
where
T: Number,
{
gen_vec(n, |_| self.gen(range.clone()))
}
pub fn gen_nonempty_range(&mut self, n: usize) -> Range<usize> {
let x = self.gen(0..n);
let y = self.gen(0..n);
if x <= y {
x..y + 1
} else {
y..x + 1
}
}
pub fn gen_bool(&mut self) -> bool {
self.gen(0..2) == 0
}
}
}
}
}
fn main() {
crate::solution::submit();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 2140kb
input:
5 100 400 -2 -1 -150 99 98
output:
3
result:
ok answer is '3'
Test #2:
score: 0
Accepted
time: 0ms
memory: 2108kb
input:
1 1 1 0
output:
1
result:
ok answer is '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 2052kb
input:
8 5 25 -2 -2 3 0 0 0 0 0
output:
2
result:
ok answer is '2'
Test #4:
score: 0
Accepted
time: 0ms
memory: 2084kb
input:
7 50 254 -33 44 1 1 1 -1 -1
output:
2
result:
ok answer is '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 2136kb
input:
7 50 254 -39 44 1 1 1 -1 -1
output:
3
result:
ok answer is '3'
Test #6:
score: 0
Accepted
time: 0ms
memory: 2092kb
input:
12 222 1240 166 165 164 163 140 -138 139 -64 -64 -62 -61 -60
output:
3
result:
ok answer is '3'
Test #7:
score: 0
Accepted
time: 0ms
memory: 2104kb
input:
17 222 1240 166 165 164 163 140 -138 139 -64 -64 -62 -61 -60 -30 -30 34 34 31
output:
4
result:
ok answer is '4'
Test #8:
score: 0
Accepted
time: 15ms
memory: 2264kb
input:
1000 13 7000 -62 336 -2593 1828 1962 -2910 -742 2331 -36 1845 -1442 1347 966 400 1108 681 2686 236 -28 -2054 664 1892 1218 143 -952 2732 56 -563 -1521 2052 -624 -1574 2722 204 2228 224 563 -2940 -806 1749 913 -126 -76 -2715 40 2540 -312 2688 1068 -2398 260 -1110 -2448 -899 -1144 -1538 -2553 -1702 91...
output:
7
result:
ok answer is '7'
Test #9:
score: 0
Accepted
time: 18ms
memory: 2228kb
input:
1100 1300 7500 -62 336 -2593 1828 1962 -2910 -742 2331 -36 1845 -1442 1347 966 400 1108 681 2686 236 -28 -2054 664 1892 1218 143 -952 2732 56 -563 -1521 2052 -624 -1574 2722 204 2228 224 563 -2940 -806 1749 913 -126 -76 -2715 40 2540 -312 2688 1068 -2398 260 -1110 -2448 -899 -1144 -1538 -2553 -1702 ...
output:
501
result:
ok answer is '501'
Test #10:
score: 0
Accepted
time: 1487ms
memory: 4024kb
input:
10000 1300 7500 -2178 2108 -2585 28 2524 -336 -2180 2309 -2140 47 -1772 115 2664 2412 1650 137 338 1224 -2962 -2622 1164 2362 834 1455 -848 2108 2792 -1713 -2405 412 -2224 -822 1200 1428 778 842 765 -2872 -492 1195 2011 -2386 -2540 -649 2128 1384 -2390 2978 22 -1870 1932 -790 -2062 -1499 -106 -1346 ...
output:
4506
result:
ok answer is '4506'
Test #11:
score: 0
Accepted
time: 1463ms
memory: 3936kb
input:
10000 1300 7500 -78 8 -185 28 124 -36 -80 209 -40 47 -272 115 264 12 150 137 38 24 -262 -222 264 262 234 255 -248 8 92 -213 -5 112 -124 -222 0 228 178 242 165 -172 -192 295 211 -286 -140 -49 28 184 -290 278 22 -70 132 -190 -262 -299 -106 -146 -99 0 121 -18 -28 123 -76 -122 -212 -226 114 -108 35 161 ...
output:
2000
result:
ok answer is '2000'
Test #12:
score: 0
Accepted
time: 15ms
memory: 2224kb
input:
1000 130 750 -18 8 -5 28 4 -6 -20 29 -10 17 -2 25 24 12 0 17 8 24 -22 -12 24 22 24 15 -8 8 2 -3 -5 22 -4 -12 0 18 28 2 15 -22 -12 25 1 -16 -20 -19 28 4 -20 8 22 -10 12 -10 -22 -29 -16 -26 -9 0 1 -18 -28 3 -16 -2 -2 -16 24 -18 5 11 -20 -24 22 21 25 2 24 8 -8 -24 8 -18 -9 -24 -9 12 -4 -2 -28 14 18 -12...
output:
200
result:
ok answer is '200'
Test #13:
score: 0
Accepted
time: 15ms
memory: 2208kb
input:
1000 130 750 -8 8 -5 8 4 -6 0 9 0 7 -2 5 4 2 0 7 8 4 -2 -2 4 2 4 5 -8 8 2 -3 -5 2 -4 -2 0 8 8 2 5 -2 -2 5 1 -6 0 -9 8 4 0 8 2 0 2 0 -2 -9 -6 -6 -9 0 1 -8 -8 3 -6 -2 -2 -6 4 -8 5 1 0 -4 2 1 5 2 4 8 -8 -4 8 -8 -9 -4 -9 2 -4 -2 -8 4 8 -2 -2 0 0 -2 -5 3 -4 -3 2 -1 2 -8 -8 -2 -6 7 -6 8 5 -6 1 2 -7 -4 6 -...
output:
200
result:
ok answer is '200'
Test #14:
score: 0
Accepted
time: 0ms
memory: 2144kb
input:
11 130 720 1 -2 3 4 5 -6 7 -8 -9 10 11
output:
3
result:
ok answer is '3'
Test #15:
score: 0
Accepted
time: 15ms
memory: 2408kb
input:
1000 13000 75000 -7062 3336 -3593 7828 3962 -5910 -742 5331 -6036 1845 -6442 7347 966 3400 108 681 6686 7236 -7028 -3054 6664 7892 9218 4143 -4952 1732 9056 -5563 -5521 2052 -1624 -574 6722 7204 1228 224 8563 -7940 -5806 2749 7913 -8126 -3076 -8715 8040 1540 -1312 1688 7068 -2398 260 -3110 -9448 -88...
output:
225
result:
ok answer is '225'
Test #16:
score: 0
Accepted
time: 1631ms
memory: 3952kb
input:
10000 13000 240000 -7062 3336 -3593 7828 3962 -5910 -742 5331 -6036 1845 -6442 7347 966 3400 108 681 6686 7236 -7028 -3054 6664 7892 9218 4143 -4952 1732 9056 -5563 -5521 2052 -1624 -574 6722 7204 1228 224 8563 -7940 -5806 2749 7913 -8126 -3076 -8715 8040 1540 -1312 1688 7068 -2398 260 -3110 -9448 -...
output:
581
result:
ok answer is '581'
Test #17:
score: 0
Accepted
time: 1555ms
memory: 4172kb
input:
10000 13000 2400000 -27062 13336 -3593 7828 3962 -45910 -30742 45331 -16036 11845 -36442 47347 20966 43400 10108 20681 36686 47236 -37028 -23054 46664 7892 49218 44143 -24952 11732 9056 -15563 -15521 2052 -41624 -574 6722 27204 31228 30224 28563 -47940 -5806 42749 7913 -18126 -43076 -48715 18040 154...
output:
56
result:
ok answer is '56'
Test #18:
score: 0
Accepted
time: 1530ms
memory: 4100kb
input:
9936 400 40043 -8 8 -5 8 4 -6 0 9 0 7 -2 5 4 2 0 7 8 4 -2 -2 4 2 4 5 -8 8 2 -3 -5 2 -4 -2 0 8 8 2 5 -2 -2 5 1 -6 0 -9 8 4 0 8 2 0 2 0 -2 -9 -6 -6 -9 0 1 -8 -8 3 -6 -2 -2 -6 4 -8 5 1 0 -4 2 1 5 2 4 8 -8 -4 8 -8 -9 -4 -9 2 -4 -2 -8 4 8 -2 -2 0 0 -2 -5 3 -4 -3 2 -1 2 -8 -8 -2 -6 7 -6 8 5 -6 1 2 -7 -4 6...
output:
100
result:
ok answer is '100'
Test #19:
score: 0
Accepted
time: 1523ms
memory: 4124kb
input:
9952 400 40043 -8 8 -5 8 4 -6 0 9 0 7 -2 5 4 2 0 7 8 4 -2 -2 4 2 4 5 -8 8 2 -3 -5 2 -4 -2 0 8 8 2 5 -2 -2 5 1 -6 0 -9 8 4 0 8 2 0 2 0 -2 -9 -6 -6 -9 0 1 -8 -8 3 -6 -2 -2 -6 4 -8 5 1 0 -4 2 1 5 2 4 8 -8 -4 8 -8 -9 -4 -9 2 -4 -2 -8 4 8 -2 -2 0 0 -2 -5 3 -4 -3 2 -1 2 -8 -8 -2 -6 7 -6 8 5 -6 1 2 -7 -4 6...
output:
100
result:
ok answer is '100'
Test #20:
score: 0
Accepted
time: 1387ms
memory: 3728kb
input:
9052 40 40007 0 2 -2 1 1 0 -2 2 -1 2 -2 1 0 0 0 2 2 0 -1 0 0 1 0 0 -2 2 2 0 -2 1 -1 0 0 0 1 2 0 -1 0 1 1 -1 -2 -1 1 1 -2 2 1 -1 0 -1 -1 -2 -1 -2 0 0 1 0 -1 0 -1 -2 -2 -1 0 0 2 2 -2 0 1 0 1 2 0 2 -2 0 2 0 0 0 0 0 -1 -2 -1 2 0 0 -2 0 0 0 0 2 0 0 1 -2 0 -1 -1 -1 -1 1 -1 0 0 0 0 1 -2 0 1 -2 -1 2 0 0 -2 ...
output:
10
result:
ok answer is '10'
Test #21:
score: 0
Accepted
time: 0ms
memory: 2220kb
input:
13 40 40007 2 2 -2 2 -1 1 1 0 -2 9888 -10035 -10035 -10035
output:
2
result:
ok answer is '2'
Test #22:
score: 0
Accepted
time: 1252ms
memory: 3856kb
input:
9048 40 40007 -1 0 0 -2 -2 2 0 -2 0 1 1 1 -1 -2 0 -2 0 1 0 0 2 0 0 0 0 -1 -2 -2 -1 2 -2 -2 -1 0 2 -1 2 1 -1 -1 -2 -1 -2 0 2 0 -1 -2 0 0 0 -1 0 0 -1 0 0 0 2 2 -1 1 -1 -2 -2 1 2 1 -2 -1 2 -1 0 0 0 -1 2 2 -1 2 -2 -1 1 1 -1 1 0 -2 -2 1 0 0 -1 0 1 -1 2 0 -1 -2 0 -1 2 2 1 0 2 -2 0 -2 0 0 0 1 -1 2 -1 1 0 2...
output:
10
result:
ok answer is '10'
Test #23:
score: 0
Accepted
time: 1604ms
memory: 3876kb
input:
9948 400 40007 -1 -1 1 0 2 -2 2 0 1 2 0 0 0 0 0 0 0 -2 -1 0 2 -2 0 -2 1 0 -2 2 -1 2 1 2 -1 0 1 -2 0 1 0 -1 -2 2 -2 -1 1 0 -1 0 2 2 -1 2 1 2 -2 2 -1 0 1 0 -2 0 -2 1 0 -1 -2 0 -2 -2 0 2 0 -1 2 -2 2 0 0 2 -1 2 2 -1 -2 1 1 -1 0 -2 2 0 -1 2 1 0 1 1 0 -1 0 1 0 -1 1 -2 1 -2 -2 2 2 -2 1 0 0 -1 0 -1 0 0 -1 -...
output:
100
result:
ok answer is '100'
Test #24:
score: 0
Accepted
time: 1596ms
memory: 4012kb
input:
9950 400 40007 0 -2 0 1 1 -1 -2 0 2 1 0 -1 -1 -2 -1 0 2 0 0 -1 2 0 2 2 2 1 0 0 -2 -2 -1 1 1 -1 -2 -2 1 -2 0 1 1 0 2 1 0 0 0 1 -1 1 0 -2 2 0 0 0 -1 2 0 0 1 0 0 0 0 -1 -1 1 0 -1 -1 1 1 2 2 0 0 -1 2 -2 0 2 0 -1 0 1 0 -1 -1 0 1 1 1 2 -2 2 2 -1 1 2 1 0 1 -1 0 0 2 1 0 1 -2 0 1 0 1 0 -2 1 2 0 2 -2 -2 0 -2 ...
output:
100
result:
ok answer is '100'
Test #25:
score: 0
Accepted
time: 1611ms
memory: 4116kb
input:
9950 400 400007 2 0 1 1 2 0 1 0 -1 -1 -1 -2 2 1 2 0 0 0 0 1 0 1 2 0 1 0 0 -2 0 -2 -1 0 0 0 1 -1 -2 1 0 1 1 -1 0 0 0 -2 2 -2 0 0 2 2 0 2 0 2 -2 -1 1 2 0 -1 -1 1 2 -1 -1 -1 2 -2 0 0 0 2 0 0 0 -2 -2 -2 -2 0 -2 -2 -1 0 1 0 1 1 -2 0 -1 2 0 1 0 2 -1 1 0 0 0 2 0 -2 -1 0 1 -1 0 -1 -1 0 2 0 -1 -2 0 0 1 1 0 -...
output:
11
result:
ok answer is '11'
Test #26:
score: 0
Accepted
time: 1587ms
memory: 4088kb
input:
9950 433 40007 2 1 1 -1 -2 1 1 0 0 0 0 0 0 0 2 1 0 0 0 1 -2 0 -1 -1 2 -2 0 1 0 1 2 -2 0 -2 1 -2 0 2 2 0 2 1 2 0 2 0 1 2 1 0 -2 0 0 2 2 0 0 0 1 1 0 1 -1 0 0 1 -2 0 1 0 1 1 1 -1 0 2 -2 -2 -1 0 1 1 2 -1 2 0 -1 -1 0 2 0 2 2 0 2 1 1 -2 -2 0 2 0 0 2 1 -1 1 -1 0 -1 -2 -2 -2 -1 -1 -1 1 0 -2 2 2 0 1 0 -1 -1 ...
output:
109
result:
ok answer is '109'
Test #27:
score: 0
Accepted
time: 1507ms
memory: 4164kb
input:
9903 555 3333 5 3 -3 2 8 -6 -3 4 -7 7 -7 -5 -6 -3 -2 1 -5 1 3 -5 6 0 1 -6 -7 5 1 -3 2 -9 -7 -9 -9 -3 7 -6 -5 3 -2 0 3 -3 4 -8 0 -3 -3 7 4 -9 7 8 -8 8 -2 -6 -5 9 2 0 0 0 6 -2 3 -6 -7 -5 4 7 7 -2 4 -3 0 4 0 7 -8 -5 5 6 -7 8 8 1 -7 6 -2 1 5 4 5 -8 5 -6 1 6 -5 8 -1 6 3 -5 6 6 2 9 -1 7 5 6 2 0 1 9 8 6 -3...
output:
1918
result:
ok answer is '1918'
Test #28:
score: 0
Accepted
time: 1508ms
memory: 3984kb
input:
10000 1 1000000000000000000 307207210817540723 -51828971826426360 -155471930464895254 470060211550206025 -57887157012127528 403463075241999530 -36866923483833823 131084413553865338 -389803010131001518 164230248073750222 -430770566255098895 -223867268447943264 111213250143745507 362061622723265689 -3...
output:
2
result:
ok answer is '2'
Test #29:
score: 0
Accepted
time: 1553ms
memory: 3976kb
input:
10000 1 1000000000000000000 579038342 715 6829375903001513 -9490672588432324 3 51879112 -3657886645959950 13 -4924112 2145 -7552 -34622785488 -203276337577492 249618072 87138 5827773746 60774 421671120452 76207 10530575078992 104522316578 153719878 -2090 16 -1 308659977 -133775447628565074 564376306...
output:
2
result:
ok answer is '2'
Test #30:
score: 0
Accepted
time: 1529ms
memory: 3964kb
input:
10000 1 1000000000000000000 998213 -446 -2012341748039513 2570953 -51822841195312322 -15905938 -3212436783514 124286152399 32463782346 -7 313 159328816443588 -225131020692169804 -647396158 3532511616813 -2231361570761 -132725401240250260 -2805 1489289 -969 22465116475 -3 -1458888 -30234901945 -11014...
output:
2
result:
ok answer is '2'
Test #31:
score: 0
Accepted
time: 1516ms
memory: 3924kb
input:
10000 1 1000000000000000000 -145 3942812 -16 26177967742 935136163532 -119013423928 -16526514850789 -19760512342 26467 -9781 -37035672741450 -2363868335147 -42899113 -2 -49873723152 -24446621668957 -408 5084610 -186881904329015070 10237908687603 -291 23531044546 -47554 -20844 -3648633785 -451 -35525...
output:
2
result:
ok answer is '2'
Test #32:
score: 0
Accepted
time: 1507ms
memory: 3924kb
input:
10000 1 1000000000000000000 -1574978579 48439113288739 -3439883756 -24587433 16209897717833318 2327 706400567 3135702030356294 -59273456451 -2159262123108134 -271076 -376512399171 -143049022289146514 -1567427713 499338208970928564 400005311333 -54846420569 3667986656914725 -1034125546543116 65321273...
output:
2
result:
ok answer is '2'
Test #33:
score: 0
Accepted
time: 1499ms
memory: 3932kb
input:
10000 1 1000000000000000000 159319 -391967 -108619312875385815 -189963 117273150 -428043299812 208943367570580665 271106282834408021 459528 67770982948595759 -338492105771252 -63 146887002 -450542908564 -53831366 489 405 230 -289119983369206183 -448473 422982225174967992 -478 442 29548 2927573156169...
output:
2
result:
ok answer is '2'
Test #34:
score: 0
Accepted
time: 1475ms
memory: 4004kb
input:
9869 1 1000000000000000000 379257594370510138 390586229900169839 -28382193623373511 191273674363738130 59378408684696024 172431650959622540 -252704407331055425 163996254067005869 154169853591448510 312558419817244331 -186532421539280472 -267403429074143399 72364986877896241 -225478700883162003 13140...
output:
2
result:
ok answer is '2'
Test #35:
score: 0
Accepted
time: 1505ms
memory: 3932kb
input:
9900 1 1000000000000000000 5318103527188822 89997324239190010 -9115424816624183 -39504630775384936 303186470194184324 176876894166070304 -158219991170323387 83991863481491267 132488327512514039 252422044202237076 -259306684737416839 41422662778646280 49622449646815561 -241049731859422188 -1851556026...
output:
2
result:
ok answer is '2'
Test #36:
score: 0
Accepted
time: 1432ms
memory: 4048kb
input:
9882 1 1000000000000000000 204145248046827865 -197030150462051887 318194948664833994 -17866718817308100 -35284674916339581 -43730864217965037 153162766261048350 -21475449716485491 49320749249958204 -28691973772478242 -112781737179390795 21783699582116414 278928513294272319 -45267468742755972 4355946...
output:
2
result:
ok answer is '2'
Test #37:
score: 0
Accepted
time: 1241ms
memory: 3744kb
input:
9128 1 1000000000000000000 -17829984991544631 -14390334268445820 63116482828035415 -748274657049904 -18115119326124028 -166327159797051039 95543164718997418 -83376375802632703 -99563761924367 30170821805706895 207893569738556747 -145977643560580273 169180623600153436 -134114641188413836 -12480336565...
output:
2
result:
ok answer is '2'
Test #38:
score: 0
Accepted
time: 1535ms
memory: 3964kb
input:
10000 10 1000000000000000000 -188429222130056366 452160237731225440 296947646948256977 484008183949314836 334868423103662296 491296158892944201 119435474962393372 302653795810241599 357629666458896982 -225042028945786366 -346241187182033659 95551553523405308 304317987655304101 167228779156145105 207...
output:
2
result:
ok answer is '2'
Test #39:
score: 0
Accepted
time: 1548ms
memory: 4048kb
input:
10000 10 1000000000000000000 -2016285939104 -1 58703523013892 220413118448679 -1327641627 40 -1 1277670428641100 2 14 -377529817430108327 270 182139132 -19 -2368474 5 -8687159312 43875386789943 46948662173 77685298287786464 -31737015 25484391151 237135798109881256 6336783637400280 25050 3 6501344068...
output:
2
result:
ok answer is '2'
Test #40:
score: 0
Accepted
time: 1473ms
memory: 4004kb
input:
10000 10 1000000000000000000 56323851383 33761780 -13887107921709 -3 -13434 65515 -177518757696 -256673 -10532250311621709 627728268205525 -35372146096983584 0 -93 21496 -395374454 -12431318241193051 -59524615997280882 2260 24156361694420857 1344864285788989 -850336 21460 29 101879481899110 -7100741...
output:
2
result:
ok answer is '2'
Test #41:
score: 0
Accepted
time: 1543ms
memory: 4140kb
input:
10000 10 1000000000000000000 326602779420267638 -14900463556785 -3443422541557387 456 169948135933641 17847988 294357784227427516 73467166 -7468923683392867 -3628557 -24504052343674 48 4126 -275257033169221 647520580 4652 -11 306722040918 -3170760858410030 -121725524984 34359548673586 -23154978418 3...
output:
2
result:
ok answer is '2'
Test #42:
score: 0
Accepted
time: 1490ms
memory: 3960kb
input:
10000 10 1000000000000000000 3639785477 -18 31030893 12542497781691 -299 -47635172 -40705859 -16332 -65478636097 -1783652328 36332134 15614619 -260394957519838929 -43 51239 21 31448170 22913822085184 287590 192573 898705546 452159965216605879 26188938981125 107530 30893745740793 -45741313298548 4727...
output:
2
result:
ok answer is '2'
Test #43:
score: 0
Accepted
time: 1526ms
memory: 4084kb
input:
10000 10 1000000000000000000 -59127250683358 -443194661 201 -39024 378199242 164574012053829705 231353985956945882 320072 69948729877568461 467176901856281 -375257081700750852 -321 107646 -184666381 -227568 -464160178 -215262978 371 -338658620701066 -170797338158401944 54744533 -146383935912978 4709...
output:
2
result:
ok answer is '2'
Test #44:
score: 0
Accepted
time: 1511ms
memory: 4008kb
input:
9869 10 1000000000000000000 127450222624905131 -342191541832523670 -227795350107531229 -49819736615491400 15733743914505454 -290452291125718361 142049826870657926 9003537929190458 -112144509664285076 203844318523904442 -160801586648484023 -338684926706821231 32240504605031944 -91919366912941432 4340...
output:
2
result:
ok answer is '2'
Test #45:
score: 0
Accepted
time: 1452ms
memory: 3996kb
input:
9900 10 1000000000000000000 336749700342531929 205804655037052316 373948437399241536 69756474965747559 13851999859093359 -13777259475625364 -130114895379711518 326338195632089176 -8152347852238426 -86822816795201527 9643002257300782 104979952130299482 55542668478808697 -57915721276757460 11291656090...
output:
2
result:
ok answer is '2'
Test #46:
score: 0
Accepted
time: 1494ms
memory: 3924kb
input:
9882 10 1000000000000000000 216492360927348032 79127204941370446 291492684790014616 -275130645625874047 -262437782933732000 221918035493815420 241800056609432930 -77807418435186602 32987662696876244 31460037873942898 120540789861006240 -91587396036587691 -257842906094392641 228805557740678978 301518...
output:
2
result:
ok answer is '2'
Test #47:
score: 0
Accepted
time: 1234ms
memory: 3708kb
input:
9128 10 1000000000000000000 -70709547110785348 215122318167890381 -44705149424117644 -12246758552715582 -3239653051159311 283278561273484501 148229749659781689 -80222850228103072 -107680815556667410 -96736102140158571 163530963667175524 323378893411035370 202014670907454212 18775129027446965 4561619...
output:
2
result:
ok answer is '2'
Test #48:
score: 0
Accepted
time: 1497ms
memory: 3940kb
input:
10000 100 1000000000000000000 465454983900121810 421282267688121046 -206675507286263746 -98905983145766611 72545421379690968 -37620934800706567 149325438602652331 362050504882667605 2716111897795390 480671570405012962 68653440204984183 340140825111761180 485912059491710481 21981415309185217 45221566...
output:
2
result:
ok answer is '2'
Test #49:
score: 0
Accepted
time: 1529ms
memory: 3948kb
input:
10000 100 1000000000000000000 37520 18 3582970057690 25705 8983943492753 13384520798 -79375932 -833436137491104 -15597904 -2026 -56841596837 -29 -69114623 18 -195727665362568 226903465781 -150 3 -222705 5990407222 -155124648675 426116236430136064 59095108024505391 35152 -710625 -11892302 -13533 -15 ...
output:
2
result:
ok answer is '2'
Test #50:
score: 0
Accepted
time: 1597ms
memory: 4084kb
input:
10000 100 1000000000000000000 -373881681994 -5778159330866676 -8 -5554796422589 132992651 -31098451 -1745 59118 -3625356 388931651474 668418713 -395860 -1 56872665 417463681 -488204866408 6144 -22530940779119 597927787778 -8322 -3017582372127678 -231 352510106086857 -2357493824 -165642242324114195 5...
output:
2
result:
ok answer is '2'
Test #51:
score: 0
Accepted
time: 1468ms
memory: 4112kb
input:
10000 100 1000000000000000000 -107885771441 -46836 -1398067377 11065236136554 -1327050465847 8124298 -41892449782521 109275439552 -15135279 -338657208397 212313 -483 42947071204036 -2 67716706128 4674 19 452962665791012273 366069124383369265 4184426 -3 39400339724 289059242425272804 47937870829606 4...
output:
2
result:
ok answer is '2'
Test #52:
score: 0
Accepted
time: 1540ms
memory: 3976kb
input:
10000 100 1000000000000000000 -2398067104133173 11558831570975 33 207406521881786680 283767235015 -425372562989559329 -875668339 1655697985 3889859286 -672586232 -3842 165579865158 10169099064505 13826701 268440984497761091 464093 -407954 -22582647 -2675806416302647 -392255581028 -39968086108559 -12...
output:
2
result:
ok answer is '2'
Test #53:
score: 0
Accepted
time: 1595ms
memory: 3940kb
input:
10000 100 1000000000000000000 -330995867492 -285492189588 202 -272790178612 201 173713 204162345532 250910 119457305 425962761 -341224051291417313 -223945 -260203392187300042 -194159 -405368595801841026 324933189810023497 -239571624484759 -269396205332676 195477804 -46582410 -476073901221 3562499670...
output:
2
result:
ok answer is '2'
Test #54:
score: 0
Accepted
time: 1483ms
memory: 4160kb
input:
9869 100 1000000000000000000 -174601232117746995 -50838100389648586 -233827590036102667 313112666344389297 -424894673100379103 11015858642049584 -31916076202255428 207106270932448264 324483180370488161 155670763768878977 289026539227258840 355535715720307115 -220136872395284219 -145918456498558697 -...
output:
2
result:
ok answer is '2'
Test #55:
score: 0
Accepted
time: 1469ms
memory: 3956kb
input:
9900 100 1000000000000000000 191087052087096503 31394493233427252 270530717776770644 349196740990517565 285500335709234413 52545029203865724 -121129932504788753 318904092162859665 -74291274258272280 -249171866592127210 168314649980024720 400585653481344582 -115802048949908244 -123841328709811476 560...
output:
2
result:
ok answer is '2'
Test #56:
score: 0
Accepted
time: 1526ms
memory: 3936kb
input:
9882 100 1000000000000000000 -236923974382242402 -83328459983944825 35244765316510201 -88444857094856853 169640379691795556 198578810641376604 -295439909863936488 82797330683588597 -129464216296516862 175182552261299364 141785637324398231 79948904519331035 142441547560609405 53710801225933916 107859...
output:
2
result:
ok answer is '2'
Test #57:
score: 0
Accepted
time: 1258ms
memory: 3724kb
input:
9128 100 1000000000000000000 -29027264455003039 -108100048953075590 49743972477806428 6702809306039248 -89911657558243001 -312909703268374067 -262215585290461370 -164236091099633168 -144153400346433046 -228868659962066145 -82597490479672412 -196162331767735176 418288348569059489 -223222336548908245 ...
output:
2
result:
ok answer is '2'
Test #58:
score: 0
Accepted
time: 1469ms
memory: 4168kb
input:
10000 10000 1000000000000000000 -284805809145135482 370078690866786371 224358302312814818 31526595246066099 -145166551808155014 371943459845652508 -396336433213684993 -245430373088501375 95785401669252942 -243276459989656055 409289496909926729 -285160369835187034 145831843487739821 -3790959948671813...
output:
2
result:
ok answer is '2'
Test #59:
score: 0
Accepted
time: 1553ms
memory: 4124kb
input:
10000 10000 1000000000000000000 181734302156543 750521045 -34 -6 70969 7485 -704126 250953881 13068834662 -702708093578207 -21219399840 -57 3134470852 326651075595564 -93045418839025766 67648032108152 291711 196599 10305817924385344 1680734941 -1731 -20314140751792836 28159632 935841843030 -3998838 ...
output:
2
result:
ok answer is '2'
Test #60:
score: 0
Accepted
time: 1507ms
memory: 3984kb
input:
10000 10000 1000000000000000000 357813 -1359765737391 -79 3 76551199257 17685535813246 986059 10264 -28901013337236 -3154655503267937 -1935757816 -435199729446495 -1 -1851497854206513 -22 226 63 3 -27176985215305026 -2833833173 -47706072256383 8963086 -639677358791 474 4866370119 -32610151189205276 ...
output:
2
result:
ok answer is '2'
Test #61:
score: 0
Accepted
time: 1462ms
memory: 4020kb
input:
10000 10000 1000000000000000000 -421845 48764306 4393 407666225103 -4077933 3827 -3588 -25740878 3254900851 -3669031211953176 147829813865 -35234494 4798751 211779067061306221 28637957536 302098324087901160 370681078034086745 -649186337104 -240159 -3613 176999 -4934845 459012447 462069840407546259 -...
output:
2
result:
ok answer is '2'
Test #62:
score: 0
Accepted
time: 1448ms
memory: 4008kb
input:
10000 10000 1000000000000000000 1296791524 20616571124302 -311249315 387406260297 3717 14681155765657293 2570 39247325885884 34534005738306 1916 -24279154 -29 284974 -460946015504267811 141280599116 4580260413220593 1279895093 1609879289726 -62926 294 294401 -192922330873839087 1220499218 4077852123...
output:
2
result:
ok answer is '2'
Test #63:
score: 0
Accepted
time: 1495ms
memory: 3980kb
input:
10000 10000 1000000000000000000 -154206832267 -305993295 164494555797580 333724776 223855309414424575 -243 28082913473621255 -435757226068946563 -425438165514 85957390 489202994769077977 -236862369863726101 -92024540135 -294670 -174773763723237918 -254062381 312009787 311720782278306 -338 159326701 ...
output:
2
result:
ok answer is '2'
Test #64:
score: 0
Accepted
time: 1423ms
memory: 3956kb
input:
9869 10000 1000000000000000000 71835319352452198 209808483803929445 -69721761241298699 -197174184580975238 -4606073688754224 -26625720979752349 -31635093290106371 149131902303261582 61925925355690801 336628480566368007 -339476070192171113 -72308340115805729 -1500058509375228 -219559969300052690 -399...
output:
2
result:
ok answer is '2'
Test #65:
score: 0
Accepted
time: 1491ms
memory: 4120kb
input:
9900 10000 1000000000000000000 21318991834470284 68840957556576744 62810691154012674 344737656290828978 235519883084522913 360134343626606979 -135773103195890912 360462586188042041 119601103889991734 112330688816263267 197697154673956564 -247098766008716058 299600067213113603 378877167258432582 -103...
output:
2
result:
ok answer is '2'
Test #66:
score: 0
Accepted
time: 1530ms
memory: 4076kb
input:
9882 10000 1000000000000000000 -404912009742321579 308032230091867976 84106525105677081 -20333958406072530 -302557150481137974 -119210281559871652 304855949769990711 108357390340851994 -187371232403543381 -177387691459848789 173572630376526404 -60231851267592920 484592483877773434 -17580269283886925...
output:
2
result:
ok answer is '2'
Test #67:
score: 0
Accepted
time: 1156ms
memory: 3736kb
input:
9128 10000 1000000000000000000 -9640235846762702 182612215369624021 57954763433860503 17138580572241541 288713767895625779 455025760899216562 136509083350017735 57514290691640954 3372356714192440 -108550446323886336 -348032114381641599 410640608191223426 -38231200898732083 -47425233189503477 4354979...
output:
2
result:
ok answer is '2'
Test #68:
score: 0
Accepted
time: 1459ms
memory: 3960kb
input:
10000 1000000 1000000000000000000 -112637353398201204 -198887503823721612 354790876416080582 -186185377936379433 41025805986778511 -397090448823110265 -227189348038249721 71010949247225530 -404790591867169426 320731637873490036 -216011698036590836 374759418462209852 -255245558094271839 -462765215827...
output:
2
result:
ok answer is '2'
Test #69:
score: 0
Accepted
time: 1501ms
memory: 4008kb
input:
10000 1000000 1000000000000000000 135678925838 3625081437324 27 -21 -50318670273241 -48 -1024 -15124562169190 8 -651170358 -62261859849067273 2215 -113565654388935 211954520363209 -5975113164618 -5204104278175 43135 -130334165437 -7035559 81321 176766552 -1912291772 -237 4723846 -102574718 433723473...
output:
2
result:
ok answer is '2'
Test #70:
score: 0
Accepted
time: 1497ms
memory: 3952kb
input:
10000 1000000 1000000000000000000 -7568418 -44386941287213157 7039 330951424 126003465 -237471388544549 -817537185335 -70214786758769 -448828690489 -144893793061 12190848125658 9 -599073628 46154 1079 4854865 395966931 -446963 -13923676240815 2466411660097722 117 -373999250251679905 -207 334648 -189...
output:
2
result:
ok answer is '2'
Test #71:
score: 0
Accepted
time: 1520ms
memory: 3928kb
input:
10000 1000000 1000000000000000000 57525 4812524 -158404078002123 447626562623252 -354839 -3726589008 -13538271 149365218 -33421691556 25498 -18262 4629497 4 77 21756902 -3373919060202 23657 -356 3083843554 18196611097267459 -2483 -19403400702151096 -41695 28 4230102204737987 80 85988649 -33326729096...
output:
2
result:
ok answer is '2'
Test #72:
score: 0
Accepted
time: 1547ms
memory: 4060kb
input:
10000 1000000 1000000000000000000 -106025010851003 3790527917 -4119 50104176650140958 3 -16 -17 1495 -701023153726136 -1425 45259035436367 -464732900769 116008324801748679 215174869343 297281066432478684 72568591151653 -473861007917 314830 -2600608253 -4183638462232 3711956651085722 3528172416079503...
output:
2
result:
ok answer is '2'
Test #73:
score: 0
Accepted
time: 1506ms
memory: 3980kb
input:
10000 1000000 1000000000000000000 98123132380102 135 96 168990 83593891985 -368970768539608 303920941341 95679428994855 -483612826856815296 -115025290086 -338798474355382415 -315543449000 367 369002213 -278089510951434524 390394 -17 -213 -424 -81543 -428463 -218761285283 396399178786092 473790113959...
output:
2
result:
ok answer is '2'
Test #74:
score: 0
Accepted
time: 1459ms
memory: 4000kb
input:
9869 1000000 1000000000000000000 354402958799199817 -206599670057885530 21060459815103523 -123188622098700724 -736939617150601 -294744774584377014 103868593838220494 92965626984274878 19404239509946131 -141402587249723500 64383780836629089 -102996637924053534 -324651875200236652 -91520807854099639 -...
output:
2
result:
ok answer is '2'
Test #75:
score: 0
Accepted
time: 1414ms
memory: 3920kb
input:
9900 1000000 1000000000000000000 -133195676617621589 2109464771941141 -159116398387078451 25414702566927838 372163313756802288 -102866184644219293 -386984250701953970 -72301417460235401 135109437409350180 268269177532977447 -258070017840591989 172634845856300277 -214851833287834296 15422489124351455...
output:
2
result:
ok answer is '2'
Test #76:
score: 0
Accepted
time: 1453ms
memory: 3976kb
input:
9882 1000000 1000000000000000000 -33701828470742571 -326929783674370424 -41406821421772726 -330345727129588281 -37238790057222475 -257097613661666137 170213905832984712 -46963698790198492 -9388851259294984 77892860690129205 -109989358060247500 -490160138010121176 209809801650719596 23753235617221181...
output:
2
result:
ok answer is '2'
Test #77:
score: 0
Accepted
time: 1242ms
memory: 3916kb
input:
9128 1000000 1000000000000000000 -374512274349689253 -45267327330323909 415819872390020866 286441550799969653 -403874169101398961 169115244849376568 253411036836489041 37056032124694113 157013483694865731 -13010388825350840 180118148346542919 -16404972172524077 85450328331578779 75543026885983714 26...
output:
2
result:
ok answer is '2'
Test #78:
score: 0
Accepted
time: 1567ms
memory: 4112kb
input:
10000 100000000 1000000000000000000 95024415092550015 -68454929382370848 -86293133483125750 6984194606388 495363934916856539 -4571322051846898 89251974541512184 -429565043547191838 -64154535115741430 -304569560626979824 443908094698828347 -26317986775724104 429064796372243233 -70704833965716009 2954...
output:
2
result:
ok answer is '2'
Test #79:
score: 0
Accepted
time: 1509ms
memory: 4128kb
input:
10000 100000000 1000000000000000000 265685488172 5974150526664053 28877098259233 31924 -12541335014722223 -9610 -721 -61933056 -31641563865175 66817753715105 -2545154608171 -10574632535791544 363108870711 -55 -211321865654955985 1166 24 230664005 1683 13421985515554 -1803125486 -2176379824228828 543...
output:
2
result:
ok answer is '2'
Test #80:
score: 0
Accepted
time: 1518ms
memory: 4168kb
input:
10000 100000000 1000000000000000000 -5112062176894 -892336 -81291822461 -10263928639 27344498082 -508 75077581458042 0 -693 503508 712797193339 108 -8 -196 6867961353 454673 -28058078680 -165975005388968 2452396847 130755403 -16209 1087558728138 27381686309 788028900666 1818335646 9486574853 6011509...
output:
2
result:
ok answer is '2'
Test #81:
score: 0
Accepted
time: 1557ms
memory: 4012kb
input:
10000 100000000 1000000000000000000 475858492 4282834560164225 623 -3589200 238432541467633761 -30237 22806 -45205 44433973 -29 0 -45857742596 -4637956669307722 2795317 4746115 -235763500777209193 -127026 -2 45084580560736165 -1 -1887406268551 -4514880260193026 18910738 6959778830 -4201906455864959 ...
output:
2
result:
ok answer is '2'
Test #82:
score: 0
Accepted
time: 1552ms
memory: 4108kb
input:
10000 100000000 1000000000000000000 27 41118456454580 -204626569681 -27676461 43563 2251261039 -246775 -142551912178771 421306 -218695 34705551 -33359787 250918689051 -1033333331635088 -1649741665066366 4508018636954920 1902 2533524715 -4330699447 -22 -411708584210 45210570772698 9936256893355 25995...
output:
2
result:
ok answer is '2'
Test #83:
score: 0
Accepted
time: 1516ms
memory: 3924kb
input:
10000 100000000 1000000000000000000 359694518563869775 127079 194763265 380026 484131466061 -370 -258261622232534 -124 -361781 -499869382311205306 326 -125738947607180 -443 126 348587068470 247924908736308 -244911046485664499 461004564 -487547756036 368649880030182 -434496451926541626 -3012683031347...
output:
2
result:
ok answer is '2'
Test #84:
score: 0
Accepted
time: 1462ms
memory: 4156kb
input:
9869 100000000 1000000000000000000 -234226534998779493 255137332596548254 -482822220353616154 -159302514662493968 90948058891254023 -277302027275867512 66812702887693346 -27634817289470707 -153939551677431924 152405874958116197 159370339143568104 -242982218437623550 -314552625061808583 2681917529072...
output:
2
result:
ok answer is '2'
Test #85:
score: 0
Accepted
time: 1468ms
memory: 4108kb
input:
9900 100000000 1000000000000000000 -24749998057009637 -54120098475586516 290733082309338238 -95493436674391964 -245152351750233044 -281529571150161978 57321993433342858 -149343532850446906 40029447272041352 402503913966978698 209679507955844761 -85618118336006306 94840306781771538 220962333074586974...
output:
2
result:
ok answer is '2'
Test #86:
score: 0
Accepted
time: 1457ms
memory: 4012kb
input:
9882 100000000 1000000000000000000 27796492615692633 293478936327909839 296667341842430227 135229631230930201 36608368694220618 -178706867443560052 -19804666932414101 247910854928987646 443136808683716381 134388563968628449 379263280330571054 126225441655607468 -16227969425357178 -67052256180119485 ...
output:
2
result:
ok answer is '2'
Test #87:
score: 0
Accepted
time: 1225ms
memory: 3756kb
input:
9128 100000000 1000000000000000000 44983391904281598 -103587074366134659 247727145511388819 -322935465904417424 146583609205463153 340724581193778867 -196696560346681569 -209136157596085341 -14765910843605875 198539800749664474 134513941674028780 -68671116960154610 190672222380382810 -47281253782547...
output:
2
result:
ok answer is '2'
Test #88:
score: 0
Accepted
time: 1465ms
memory: 3936kb
input:
10000 10000000000 1000000000000000000 448829100994176578 -286166827920301380 323271320308135871 454345157328184415 -335488965659123190 311870054829415007 -411323959953437888 -88928942592263842 -466083608257968195 355350311913972062 42830699372427095 -342007598004709033 53145657352728537 464127593180...
output:
2
result:
ok answer is '2'
Test #89:
score: 0
Accepted
time: 1464ms
memory: 3944kb
input:
10000 10000000000 1000000000000000000 -9126062575833 -639 -705605341 -799031911 -70484639807 803 0 -18220991074 137513334147160 -6612399 27891226565534 -3302901491 328302 -24094543161451431 8894 -1518536 -3 30606 -55 -1173345523289660 74791901135 -22 437783492 -656 -326981198580 1902131312731116 117...
output:
2
result:
ok answer is '2'
Test #90:
score: 0
Accepted
time: 1506ms
memory: 3984kb
input:
10000 10000000000 1000000000000000000 -64 -129 -56695 2655558002 623579881928434 -424993 33253435879 -9 -18139 2283240858253 -18 -24099467955 491984089273670 267 -1754619 0 15097342979012261 46339727 -202185388421931585 2617415085986030 -3 39 -33050 3622 6905775905391 -1516266147 1 291604685 3184602...
output:
2
result:
ok answer is '2'
Test #91:
score: 0
Accepted
time: 1519ms
memory: 4012kb
input:
10000 10000000000 1000000000000000000 -40213326218 -49396 176201334 2590083700528 -44356 103853244 3981452146356 19950877229102 -290546339004 -7878317227641680 -1 -489476 84580540917 -425603680796420 -43289145031054553 -22247296944773599 168760657612932 -1941855 44332495 -13663602401 22453899 -46480...
output:
2
result:
ok answer is '2'
Test #92:
score: 0
Accepted
time: 1481ms
memory: 3980kb
input:
10000 10000000000 1000000000000000000 -16222200231069 -31 -4549244643080095 -484783 29 -231973672 -24022543 -41919033376002 204037134365 -42156532087409 -10558844 5015452085681 2738821261 -7145403 497311673768 -3940549916135221 46 330293 -27070474780570 31 704415884 157047 328510 3539198250 -3381 -4...
output:
2
result:
ok answer is '2'
Test #93:
score: 0
Accepted
time: 1513ms
memory: 4012kb
input:
10000 10000000000 1000000000000000000 -28400868336114545 -199243384 -406009452931321 -215979411346076 -193497957145923013 66190010785410 7863373251186144 -242405524195 -401 -453065285151 388599466634498 163449742 132394240 -167845396004285393 344244242 144892669811148354 -15025338706624 243 -4265895...
output:
2
result:
ok answer is '2'
Test #94:
score: 0
Accepted
time: 1412ms
memory: 3932kb
input:
9869 10000000000 1000000000000000000 -164330509971071382 -243779666919281479 181069780000902592 -327548719207820199 -226546924115002065 -417474272179994572 8100005789836656 36806398384731625 -192038913414528807 60566123282812612 359693974724126786 180300991584277055 -175305819400786728 2293433722501...
output:
2
result:
ok answer is '2'
Test #95:
score: 0
Accepted
time: 1483ms
memory: 3996kb
input:
9900 10000000000 1000000000000000000 -363851509208524421 -118301969337728345 -102923812105216870 108452046424456540 76201089363405849 -190411018117682363 -305572333427170602 -806487572535409 -79871026683531999 -21221452343602973 -440624508505050110 -42165438114485642 472480979582330881 -120942452543...
output:
2
result:
ok answer is '2'
Test #96:
score: 0
Accepted
time: 1517ms
memory: 4124kb
input:
9882 10000000000 1000000000000000000 192259160138276505 -358283639720917307 -87302799541117028 79343226835429929 -326520670190857765 20326824684786020 -226957305689648908 -125021018954951445 -5829089267426670 27676458422082962 -108086338120709513 133049991693069756 15035855118824259 2379609011699999...
output:
2
result:
ok answer is '2'
Test #97:
score: 0
Accepted
time: 1235ms
memory: 3928kb
input:
9128 10000000000 1000000000000000000 -39761615724076588 -116246039807551056 318061361553493284 214035368372329167 -365919887535642113 -76234424002009684 137428971829664871 -71581352579877497 30536130363378721 -65659718088531918 276847290887831948 146353311945606238 -222713744437832108 88536824884153...
output:
2
result:
ok answer is '2'
Test #98:
score: 0
Accepted
time: 1460ms
memory: 4016kb
input:
10000 1000000000000 1000000000000000000 7747515951470247 -99972040833815559 -445761147658029198 -153128265643019515 -19045154032893990 -188697498005469657 -70685458248509892 285772321755700890 -29535441821792108 -45718674672494598 -49479420056814739 282080673025776272 -412019479346154439 13625332505...
output:
4
result:
ok answer is '4'
Test #99:
score: 0
Accepted
time: 1443ms
memory: 4020kb
input:
10000 1000000000000 1000000000000000000 -14883525328481 1789767376 24510366766169 85058791446 490102 179686 -846 -19838 1451695279 -694502 -166271 -18702851318 -1563963584002 25202846290986256 -9720388672292536 59886990383 8428435 -725603 148937259482156548 -40719998272566 -313424 -7 -18 -172886969 ...
output:
3
result:
ok answer is '3'
Test #100:
score: 0
Accepted
time: 1504ms
memory: 4012kb
input:
10000 1000000000000 1000000000000000000 -8475138 755 7610912437518 -3898264 57999 -988 -130 223 -129029522167908 -25009421238 -1494 -43114357421 5 93602 9416249930023 8624388969 41233 -20 -271085121896 772 8299 -1130528869539 -46912892 7476612433126 493451548902551351 535988353 -13300344697564654 45...
output:
2
result:
ok answer is '2'
Test #101:
score: 0
Accepted
time: 1539ms
memory: 4016kb
input:
10000 1000000000000 1000000000000000000 -4979273245 2 -2522831499699968 478302805237806 -2 396 -24171599524948 295447931477099095 -235474114329174 -1011434098511 7196 2123255765041713 2914901762773 -27139174086750 8208 2444126086979 19168848 -4831694054487643 98 -25365674537 -2242391857 2653182838 1...
output:
2
result:
ok answer is '2'
Test #102:
score: 0
Accepted
time: 1466ms
memory: 3984kb
input:
10000 1000000000000 1000000000000000000 -22725187 -276727257200 -41656242 -336479 -436418 3324 10979314 18187709792792 -1237045140555778 -1751926340512 -1725871167481628 189578380347238780 360719951303 427539943683 -39789778 297543687578294121 -36593772184636 40 34904981767727 -43737249 -41 9828249 ...
output:
3
result:
ok answer is '3'
Test #103:
score: 0
Accepted
time: 1512ms
memory: 3960kb
input:
10000 1000000000000 1000000000000000000 280182642 62511 186522 133334 333193001968063994 279 -93819949223049688 264908 68 388 -178799445358 66 -75520569818730659 -89770305417213695 -405947 414 191671412925464039 428 258940152226 169 87126559782048 47 -483746277931560 48155412 263620265547439 2860947...
output:
4
result:
ok answer is '4'
Test #104:
score: 0
Accepted
time: 1518ms
memory: 3864kb
input:
9869 1000000000000 1000000000000000000 167835617881752527 -8537224287517663 -429560527630995513 361520415878089856 -286610426421863284 -150915254952023000 -255902956619442310 -85167329469526648 225944287762917900 -251961282843418011 11691609893474405 -236876789906713158 -300601662905899402 -18374392...
output:
2
result:
ok answer is '2'
Test #105:
score: 0
Accepted
time: 1498ms
memory: 4160kb
input:
9900 1000000000000 1000000000000000000 -124168544142581034 387055252373976735 92356440022733358 27873630526826975 191100811620779001 63093016011299153 -71956209107377005 -60557090623773321 136632277407112448 -39125656439049234 -466315299700674337 435734118099217606 -99339140103114631 672848296431365...
output:
2
result:
ok answer is '2'
Test #106:
score: 0
Accepted
time: 1464ms
memory: 4156kb
input:
9882 1000000000000 1000000000000000000 221199224475622403 60476874914164804 -54903492062089064 46425404350550592 112189989658565679 -8821745723813633 -54278067058852389 152464613297289709 96627782431499301 -164746247085744234 -241091171827984849 59656390758027974 -169147546511944617 4125250890729636...
output:
3
result:
ok answer is '3'
Test #107:
score: 0
Accepted
time: 1233ms
memory: 3904kb
input:
9128 1000000000000 1000000000000000000 110067666648623394 -201179503596720045 196081259726012477 -318815728904429537 -272085936755020230 -451634037990960978 -180010244030985617 -163219781473617553 -401531490316729942 -257125131802295080 192478607187355103 280312830566190918 101958256452731281 444717...
output:
3
result:
ok answer is '3'
Test #108:
score: 0
Accepted
time: 1484ms
memory: 3968kb
input:
10000 100000000000000 1000000000000000000 417959414892731867 355013587349762468 -52893521334265831 164155556688242390 480826352427188644 152480062994425635 304060846804487545 -53860389953347224 -430563343408258768 -360866820251479527 351471844823927471 -182644408673106703 260550257530583790 -3283311...
output:
16
result:
ok answer is '16'
Test #109:
score: 0
Accepted
time: 1505ms
memory: 4124kb
input:
10000 100000000000000 1000000000000000000 107895513 26285541528 181413471710917708 -3530826912 -13032416869815223 -53036356 29004275702339488 -9 13825966 14577212700212 -2884003995886 415502306322547 6675 -25653594016 5343 -21385219536410 -6856 23690730812 6068 -809484530291 10213314147440 656047829...
output:
4
result:
ok answer is '4'
Test #110:
score: 0
Accepted
time: 1527ms
memory: 3964kb
input:
10000 100000000000000 1000000000000000000 1654530506 -7903350904061 -2545771346 2438727 -64228964 271336683513474495 3490216629 44465454641609 141546616686169 -4632 529 -690525716796 5513008494482 88 -47568506 -122997845 12231938 44471 6250 -1685 -3380228 919 -52430 -27720056 -31024079097 -215164643...
output:
4
result:
ok answer is '4'
Test #111:
score: 0
Accepted
time: 1543ms
memory: 4120kb
input:
10000 100000000000000 1000000000000000000 -196107182 -14915 -3537612302677 2492 46846067591643893 -2632 -22540 32324063916402615 407989843349176642 44864039 -431 -329603018987147561 -4896238930778 -237669921 -2025044 -18201878522868361 19830230 -295024764186538187 4 -28338094 -2333596932556 -4842149...
output:
5
result:
ok answer is '5'
Test #112:
score: 0
Accepted
time: 1492ms
memory: 4012kb
input:
10000 100000000000000 1000000000000000000 56599466019 -227077 5672263 -36769062 -16482809 482945747368826930 184461 -17648915 2033385652 31145333 10226887 47441593 -4189380881 26033279896950 -486764 -280094 -378468 2397 37943185 -4063054830759696 30357 38 -87647 -4344 514222848972267 382656138814601...
output:
7
result:
ok answer is '7'
Test #113:
score: 0
Accepted
time: 1470ms
memory: 3944kb
input:
10000 100000000000000 1000000000000000000 282035524 296513640 285663926785104066 223 -171 -435 83953003947777820 57196 270846904706 295686998835161 170420910 43845879293170905 312337 -481185 241456392260488 289012580 355 245904017 -482700516 -60524088712088968 49648520311239 247964749732062909 44486...
output:
7
result:
ok answer is '7'
Test #114:
score: 0
Accepted
time: 1458ms
memory: 4064kb
input:
9869 100000000000000 1000000000000000000 -39515326456454720 70104637696530381 -115472287210520409 98060741514614438 229727048947507752 243644420301471702 350500517342591801 388341490711866181 -257386880475903443 -488308480729620954 22268581462258984 -147803424544683514 -147888707459853600 1320281266...
output:
7
result:
ok answer is '7'
Test #115:
score: 0
Accepted
time: 1527ms
memory: 4008kb
input:
9900 100000000000000 1000000000000000000 -115295337185431076 5750718023320046 -14727571404631746 7398723080950864 -89477941709505655 37179714422530817 -192052891889223032 -244718920194393262 -75647942437643810 6740467260529870 -172484262677197811 -447458784691629509 23234766983193545 101538259244525...
output:
7
result:
ok answer is '7'
Test #116:
score: 0
Accepted
time: 1476ms
memory: 4008kb
input:
9882 100000000000000 1000000000000000000 316260932271805057 290241021926521833 -22426886880329227 35610672998915982 73109937111755616 60954711565249395 -265294914185812495 228552764645678450 38934392056966395 54028848459386808 18208621763470711 -1673793992732775 -18192120256075069 -22491227599136086...
output:
7
result:
ok answer is '7'
Test #117:
score: 0
Accepted
time: 1175ms
memory: 3948kb
input:
9128 100000000000000 1000000000000000000 223103390444564679 -79269063500145537 51335119147141316 193392755701585406 -49075254706495525 123491472812245052 2961876199214004 53425136263879378 312940249340027310 323276388167187825 246732745882839103 300845804132682525 334993899554011747 -256774596235204...
output:
5
result:
ok answer is '5'
Test #118:
score: 0
Accepted
time: 1594ms
memory: 3896kb
input:
10000 10000000000000000 1000000000000000000 -326724489483498609 -471489327476217261 308197800996996074 454357526293549224 -153987590867883361 -428371131952576929 -11069364904560570 -410387795834781180 -457930952132467898 44291948924229979 194426304274787590 -435972167501401179 -169730762115166627 -4...
output:
520
result:
ok answer is '520'
Test #119:
score: 0
Accepted
time: 1558ms
memory: 3960kb
input:
10000 10000000000000000 1000000000000000000 501870642945 8383910089542279 43265784454971678 -114193171 -1 2391 5992936030 0 -12725784664004004 107 4586642959370 -384 3635351243541 38375323 1560329483 6131701 235786773 -16 427286402719 -171472 5546 -1196576 -260660096036155 109476689663 -410756968 -2...
output:
113
result:
ok answer is '113'
Test #120:
score: 0
Accepted
time: 1553ms
memory: 3936kb
input:
10000 10000000000000000 1000000000000000000 -938595296631 165128587499395 43416647 50769 1 -574 -1072066962458 183959 -4558 327 21218911 -50510308 1207492997 -408302407624 -216399348914499 -140418654928048 16261134414 690987160752713 40174245 -1002707 -20538350446991 -60058039847746029 489 -56704432...
output:
114
result:
ok answer is '114'
Test #121:
score: 0
Accepted
time: 1510ms
memory: 4108kb
input:
10000 10000000000000000 1000000000000000000 -42398973 8267867162765 25806462 -201382297331 4748490158 -332510770286 39398680 1228 4130425399 394794 -309150666198 287214406489706251 -82754531629941868 11489391002259 4 2363258919543 4070278063790969 7887907 -29733873017857 -40 -64080226 -3550547793835...
output:
127
result:
ok answer is '127'
Test #122:
score: 0
Accepted
time: 1518ms
memory: 4012kb
input:
10000 10000000000000000 1000000000000000000 -25630513 -58388488958117153 34840467 -130812 4579246924458702 2593159450394692 -3045750581 -39 35783746 4142557528 -235123792086 -987874262 -32807142166188 27586656 935148568025755 -1 -1311642893564817 -291997191985811581 1 865947649 425127 -26657818 31 -...
output:
150
result:
ok answer is '150'
Test #123:
score: 0
Accepted
time: 1546ms
memory: 3940kb
input:
10000 10000000000000000 1000000000000000000 457319036859808186 -36086353145809265 -99 -23 -483952766 -170 95259186428 -380423 10800608 0 -351889865371025690 398221579157880648 108539163889 -442378371383297 471316671855977255 159775842 84452 -258 -124 321058034672721968 378833211644585064 -395 -297 3...
output:
165
result:
ok answer is '165'
Test #124:
score: 0
Accepted
time: 1454ms
memory: 3916kb
input:
9869 10000000000000000 1000000000000000000 258722811787782573 -224948192178789438 110378821557736008 180470680240645248 50675095965582567 19826422109491473 -414203839426791017 -397110951704094381 -428325850213611399 63932483790117871 51758847955067360 203299706791050770 35171645264830480 -1021934873...
output:
209
result:
ok answer is '209'
Test #125:
score: 0
Accepted
time: 1514ms
memory: 4108kb
input:
9900 10000000000000000 1000000000000000000 -128824905472499533 -118563014307814592 44812548477512055 128964962935994747 -413399251809061283 295920350364474888 -111755988740439463 -15067292322912097 -125693682993911350 -213924165551316842 26747154988530574 162087933395596466 -137170245368362663 -3188...
output:
202
result:
ok answer is '202'
Test #126:
score: 0
Accepted
time: 1508ms
memory: 3956kb
input:
9882 10000000000000000 1000000000000000000 205304537921561170 -79916595250096264 37682717234606648 -420155913478806076 -143339039342248201 -106123766685101691 -143093865868895540 -341037909740513866 290564485636628506 328237160543723382 134121257835358677 -30567908212893474 -52883922735119160 -10325...
output:
211
result:
ok answer is '211'
Test #127:
score: 0
Accepted
time: 1309ms
memory: 3708kb
input:
9128 10000000000000000 1000000000000000000 -279995491550703810 -80700235344503144 173166331368925497 214202174020010541 -197291946050637677 -185279449371349820 154962659705658541 -116654195995157980 146405012498662903 27270956833808755 320281610462646719 -270786830978056855 -100672813637492669 -7466...
output:
146
result:
ok answer is '146'
Test #128:
score: 0
Accepted
time: 1517ms
memory: 4084kb
input:
10000 100000000000000000 1000000000000000000 -254291817188567458 307610428064054594 97727180070061270 108776352559865077 64117146643675216 158423987625526617 -8817818362242850 348836291046833586 -207843384965345581 -282195142699180410 -2334641568169497 -315827681908983372 -88971484179109125 -3872567...
output:
3068
result:
ok answer is '3068'
Test #129:
score: 0
Accepted
time: 1507ms
memory: 3956kb
input:
10000 100000000000000000 1000000000000000000 -2291 21474 13955082580276720 -172285055410240030 1607137247414631 -51756335631694 -36230604276234 85564887 -43426029635 -9090422543510545 314080488295448 2829147995439279 -190979361486 -10 2972189 -15383696 45650658 1109 2194711 -1872784 13 27822773968 -...
output:
1149
result:
ok answer is '1149'
Test #130:
score: 0
Accepted
time: 1491ms
memory: 3856kb
input:
10000 100000000000000000 1000000000000000000 637119516288809 -1828280066893784 396461871236317990 3092 49645229381662630 -326160 1174360328110934 -16749 -3203541312 1065 -49644821645882230 -47172944655190353 -28489101984335721 -32477539875367475 614 -25646961 7253554046182144 408543 -909679154 -8495...
output:
1169
result:
ok answer is '1169'
Test #131:
score: 0
Accepted
time: 1563ms
memory: 3964kb
input:
10000 100000000000000000 1000000000000000000 38010327452084 -4274867 -418818019545 -43 39638043 313629036 3 211718745720 338153783746754959 -233653683 14 -411936171253813 444111325 27302 -203679000 53659408059819 -131 -388985 -1175228 -41288149258591 3589014 -361 39 -19049651 3 -328883 3666440478690...
output:
1236
result:
ok answer is '1236'
Test #132:
score: 0
Accepted
time: 1488ms
memory: 3980kb
input:
10000 100000000000000000 1000000000000000000 -14 -2117 -33906267635756 -3903867330628842 -277012 -3066853164812251 2610 -2252043128 2536 78 -38499576 -3647 -440570559225702098 89952339089667488 875004272480584 -961233731243297 -192492260 -151 -243451 -149730060177 -33613368182915 -330089697452 -45 4...
output:
1341
result:
ok answer is '1341'
Test #133:
score: 0
Accepted
time: 1574ms
memory: 3944kb
input:
10000 100000000000000000 1000000000000000000 61601455 -343708 228926 3 165142999868623238 -374463128 -73791532666314444 30 181442026462513 84463088 -309354462744 -414659850633164663 144676852 -268254094257533445 -357717730 11069532783256 207180980802 -32 -181164 -191983 30925937156510944 -3531193949...
output:
1442
result:
ok answer is '1442'
Test #134:
score: 0
Accepted
time: 1535ms
memory: 3932kb
input:
9869 100000000000000000 1000000000000000000 180135447507299878 396529093194677 41287974832399376 272110768895818055 -133072739476518861 -24014243475483266 -82544026552237440 -31502413939737783 65239439176410346 -153622635170861938 34935750463175240 9394274717463113 356347971237576644 590112800776571...
output:
1857
result:
ok answer is '1857'
Test #135:
score: 0
Accepted
time: 1536ms
memory: 4052kb
input:
9900 100000000000000000 1000000000000000000 352034211747652757 298072026521098399 -134588886016614324 138482679125382408 -170881727010902555 -283146383901168278 -282046240390795348 40295294519807469 145276267225510228 424414312517411612 3351215550191345 -276591220343031957 422929506816478383 3914663...
output:
1916
result:
ok answer is '1916'
Test #136:
score: 0
Accepted
time: 1533ms
memory: 3912kb
input:
9882 100000000000000000 1000000000000000000 -208614567456358389 -240484901650897482 -7877450568639496 -222703942433450189 131278680303134298 -25015052369171355 56511035559295145 -54163305360747666 183219483803517234 118020535304381200 47233075448203380 118538099909767794 -20034889726705039 -70687428...
output:
1882
result:
ok answer is '1882'
Test #137:
score: 0
Accepted
time: 1248ms
memory: 3816kb
input:
9128 100000000000000000 1000000000000000000 53928557793188321 -258730070927132147 88383388146715569 -265886894155029324 300874409107370366 -304580436252894512 338369810142192404 -101698419026464865 55239097557197055 -148163219393557352 80804694843433925 -190256795992895225 255114644609480225 1129791...
output:
1947
result:
ok answer is '1947'
Test #138:
score: 0
Accepted
time: 1649ms
memory: 3964kb
input:
10000 1000000000000000000 1000000000000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
10000
result:
ok answer is '10000'
Extra Test:
score: 0
Extra Test Passed