QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#348816 | #8328. A Good Problem | ucup-team296# | AC ✓ | 4ms | 2448kb | Rust | 13.6kb | 2024-03-09 21:32:51 | 2024-03-09 21:32:51 |
Judging History
answer
//
pub mod solution {
//{"name":"uc25_a","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":"uc25_a"}}}
use crate::algo_lib::io::input::Input;
use crate::algo_lib::io::output::Output;
use crate::algo_lib::misc::recursive_function::Callable2;
use crate::algo_lib::misc::recursive_function::RecursiveFunction2;
type PreCalc = ();
fn solve(input: &mut Input, out: &mut Output, _test_case: usize, _data: &mut PreCalc) {
let n = input.read_size();
let b = input.read_size_vec(n);
let mut bc = b.clone();
bc.sort();
bc.dedup();
bc.push(n + 1);
let mut a = vec![0; n];
let mut ans = Vec::new();
let mut rec = RecursiveFunction2::new(|rec, l: usize, r: usize| {
let mut cur = Vec::new();
for i in 0..n {
if b[i] >= bc[l] && b[i] < bc[r] {
cur.push(i);
}
}
if a[cur[0]] != bc[l] {
for &i in &cur {
ans.push((2, i + 1));
a[i] += 1;
}
while a[cur[0]] < bc[l] {
ans.push((1, a[cur[0]]));
for &i in &cur {
a[i] += 1;
}
}
}
if l + 1 < r {
let m = (l + r) / 2;
rec.call(m, r);
rec.call(l, m);
}
});
rec.call(0, bc.len() - 1);
out.print_line(ans.len());
out.print_per_line(&ans);
}
pub(crate) fn run(mut input: Input, mut output: Output) -> bool {
let mut pre_calc = ();
#[allow(dead_code)]
enum TestType {
Single,
MultiNumber,
MultiEof,
}
let test_type = TestType::Single;
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();
if false {
true
} else {
input.skip_whitespace();
input.peek().is_none()
}
}
}
pub mod algo_lib {
pub mod collections {
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 io {
pub mod input {
use crate::algo_lib::collections::vec_ext::default::default_vec;
use std::io::Read;
pub struct Input<'s> {
input: &'s mut dyn Read,
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) -> 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, 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 !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()
}
//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) -> char {
self.skip_whitespace();
self.get().unwrap().into()
}
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 char {
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)
}
}
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 u8 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::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,
}
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,
}
}
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,
}
}
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]) {
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 set_bool_output(&mut self, bool_output: BoolOutput) {
self.bool_output = bool_output;
}
}
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<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> 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!(u8 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)
}
}
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,));
}
}
}
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,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 2308kb
input:
4 2 4 3 1
output:
9 2 1 2 2 2 3 2 4 2 2 2 3 1 2 2 2 2 1
result:
ok Correct!
Test #2:
score: 0
Accepted
time: 0ms
memory: 2084kb
input:
10 4 3 7 3 6 6 10 0 10 9
output:
25 2 3 2 5 2 6 2 7 2 9 2 10 1 1 1 2 1 3 1 4 1 5 2 7 2 9 2 10 1 7 1 8 2 7 2 9 2 3 2 1 2 2 2 4 1 1 1 2 2 1
result:
ok Correct!
Test #3:
score: 0
Accepted
time: 0ms
memory: 2208kb
input:
10 6 3 3 9 1 2 4 6 9 7
output:
34 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 1 2 4 2 7 2 8 2 9 2 10 1 2 1 3 2 4 2 9 2 10 1 5 1 6 2 4 2 9 1 8 2 1 2 8 1 5 2 2 2 3 2 6 2 2 2 3
result:
ok Correct!
Test #4:
score: 0
Accepted
time: 0ms
memory: 2068kb
input:
10 2 9 4 6 8 10 6 9 7 7
output:
34 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 1 1 2 2 2 5 2 6 2 8 2 9 2 10 1 3 1 4 1 5 1 6 2 2 2 6 2 8 1 8 2 6 2 5 2 3 2 4 2 7 1 3 2 4 2 7 1 5
result:
ok Correct!
Test #5:
score: 0
Accepted
time: 0ms
memory: 2132kb
input:
10 1 2 4 7 3 1 3 6 9 1
output:
29 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 3 2 4 2 8 2 9 1 2 1 3 2 4 2 9 1 5 1 6 2 9 1 8 2 8 1 5 2 2 2 5 2 7 2 5 2 7
result:
ok Correct!
Test #6:
score: 0
Accepted
time: 0ms
memory: 2128kb
input:
10 4 4 8 3 6 1 2 3 2 3
output:
29 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 1 2 2 2 3 2 5 1 2 1 3 2 3 2 5 1 5 2 3 1 7 2 4 2 7 2 8 2 9 2 10 2 4 2 8 2 10
result:
ok Correct!
Test #7:
score: 0
Accepted
time: 0ms
memory: 2124kb
input:
10 4 3 1 8 4 6 1 1 2 8
output:
27 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 1 2 4 2 5 2 6 2 10 1 2 1 3 2 4 2 6 2 10 1 5 2 4 2 10 1 7 2 2 2 9 2 2
result:
ok Correct!
Test #8:
score: 0
Accepted
time: 0ms
memory: 2120kb
input:
100 13 66 98 73 11 2 65 56 61 30 91 83 90 84 64 44 22 21 93 7 41 46 41 18 13 23 80 20 45 32 54 35 90 52 7 44 4 8 38 13 67 14 5 35 70 15 30 72 58 31 36 40 32 43 52 76 78 27 43 42 80 78 64 43 10 23 61 2 3 19 4 47 76 79 10 89 83 9 40 37 36 35 79 19 46 24 23 5 1 100 22 55 37 24 74 75 31 48 79 87
output:
618 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61 ...
result:
ok Correct!
Test #9:
score: 0
Accepted
time: 0ms
memory: 2096kb
input:
100 12 84 19 6 50 64 72 49 6 11 62 23 35 54 41 68 77 16 88 11 19 52 25 7 79 27 68 42 86 74 25 40 44 5 30 95 36 18 83 23 47 86 69 18 100 52 0 21 94 2 92 68 23 44 41 6 17 50 93 13 30 25 66 59 21 63 7 82 51 20 70 29 99 76 50 88 54 5 26 28 10 100 92 79 55 57 92 21 55 59 82 60 49 22 13 14 69 62 13 12
output:
526 2 2 2 5 2 6 2 7 2 8 2 11 2 14 2 16 2 17 2 19 2 22 2 25 2 27 2 29 2 30 2 36 2 39 2 42 2 43 2 45 2 46 2 49 2 51 2 52 2 58 2 59 2 63 2 64 2 66 2 68 2 69 2 71 2 73 2 74 2 75 2 76 2 77 2 82 2 83 2 84 2 85 2 86 2 87 2 89 2 90 2 91 2 92 2 93 2 97 2 98 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 ...
result:
ok Correct!
Test #10:
score: 0
Accepted
time: 0ms
memory: 2176kb
input:
100 57 58 65 22 1 8 7 53 29 91 39 85 30 88 54 11 46 12 0 85 86 80 17 59 13 86 39 89 13 48 21 45 45 61 49 60 3 31 73 94 31 44 25 87 8 35 83 38 69 73 0 51 86 68 71 70 23 12 97 70 12 28 77 42 93 55 13 85 42 42 52 94 24 0 1 6 14 37 66 41 98 49 82 46 36 10 30 98 56 98 38 73 45 17 6 99 18 90 99 39
output:
556 2 1 2 2 2 3 2 8 2 10 2 12 2 14 2 15 2 20 2 21 2 22 2 24 2 26 2 28 2 34 2 36 2 39 2 40 2 44 2 47 2 49 2 50 2 52 2 53 2 54 2 55 2 56 2 59 2 60 2 63 2 65 2 66 2 68 2 71 2 72 2 79 2 81 2 83 2 88 2 89 2 90 2 92 2 96 2 98 2 99 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17...
result:
ok Correct!
Test #11:
score: 0
Accepted
time: 0ms
memory: 2164kb
input:
100 12 22 7 50 1 15 38 89 24 39 35 2 98 7 35 40 27 8 43 35 40 51 1 13 13 57 44 5 39 69 81 77 71 28 49 9 21 51 14 22 29 33 18 3 1 86 60 27 67 64 11 22 5 28 35 36 73 52 8 30 86 79 68 53 31 51 14 28 11 3 79 77 31 16 16 48 4 46 72 49 28 17 71 12 61 32 20 27 31 64 75 57 67 21 24 15 74 30 12 12
output:
594 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61 ...
result:
ok Correct!
Test #12:
score: 0
Accepted
time: 0ms
memory: 2236kb
input:
100 28 27 6 9 3 30 63 2 65 50 26 3 77 35 16 14 53 37 26 8 9 60 51 40 10 49 29 13 33 15 35 15 2 24 44 57 42 34 27 54 3 63 53 73 23 36 39 28 86 69 68 41 15 18 24 89 29 47 56 28 14 32 78 11 29 11 59 47 11 25 80 50 30 37 6 61 90 49 27 19 29 46 24 1 32 73 4 28 42 23 3 34 6 12 52 69 7 34 52 15
output:
585 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61 ...
result:
ok Correct!
Test #13:
score: 0
Accepted
time: 0ms
memory: 2080kb
input:
100 25 7 7 9 34 58 34 36 49 6 10 34 22 40 24 17 9 90 54 2 38 67 59 74 31 8 34 15 12 55 12 45 4 19 4 19 28 40 92 4 4 22 21 2 39 71 65 77 11 13 9 37 72 32 21 16 23 39 23 66 16 28 13 41 12 45 66 13 49 45 43 34 16 84 6 6 81 22 4 23 35 3 69 14 15 33 8 71 26 52 9 20 9 46 68 74 50 21 23 35
output:
571 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61 ...
result:
ok Correct!
Test #14:
score: 0
Accepted
time: 4ms
memory: 2372kb
input:
1000 34 769 740 957 126 724 943 359 299 576 260 460 760 303 348 482 42 335 484 573 302 717 25 356 310 296 235 487 342 362 379 778 964 875 655 60 13 422 136 964 240 675 262 628 805 953 686 20 305 888 982 688 366 105 508 252 971 419 715 945 910 343 835 926 63 59 441 335 322 56 75 335 128 514 839 424 1...
output:
8754 2 2 2 3 2 4 2 6 2 7 2 10 2 13 2 19 2 20 2 22 2 28 2 32 2 33 2 34 2 35 2 40 2 42 2 44 2 45 2 46 2 47 2 50 2 51 2 52 2 55 2 57 2 59 2 60 2 61 2 63 2 64 2 74 2 75 2 78 2 80 2 84 2 87 2 88 2 96 2 99 2 100 2 102 2 103 2 104 2 105 2 106 2 107 2 111 2 113 2 114 2 115 2 116 2 117 2 118 2 119 2 123 2 12...
result:
ok Correct!
Test #15:
score: 0
Accepted
time: 0ms
memory: 2432kb
input:
1000 668 960 321 884 19 156 939 362 0 202 59 402 991 327 654 803 893 662 85 825 342 200 91 867 199 649 117 64 242 668 887 663 843 105 823 639 904 992 670 315 100 941 662 237 879 900 603 575 240 532 573 310 264 442 925 924 244 634 88 635 685 180 235 178 699 356 366 623 137 24 810 783 174 553 4 767 66...
output:
8706 2 1 2 2 2 4 2 7 2 13 2 15 2 16 2 17 2 18 2 20 2 24 2 26 2 30 2 31 2 32 2 33 2 35 2 36 2 37 2 38 2 39 2 42 2 43 2 45 2 46 2 47 2 48 2 50 2 51 2 55 2 56 2 58 2 60 2 61 2 65 2 68 2 71 2 72 2 74 2 76 2 77 2 82 2 87 2 92 2 93 2 94 2 98 2 100 2 103 2 106 2 108 2 110 2 111 2 112 2 115 2 118 2 119 2 12...
result:
ok Correct!
Test #16:
score: 0
Accepted
time: 4ms
memory: 2448kb
input:
1000 969 408 165 253 331 421 61 882 701 103 489 555 712 547 769 3 619 952 972 451 564 413 293 173 488 217 689 167 114 562 419 638 340 527 348 288 785 610 769 142 753 91 36 215 576 442 762 853 20 911 843 117 741 949 209 694 126 695 389 365 92 657 663 304 277 476 692 87 315 199 33 926 232 514 714 254 ...
output:
9745 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61...
result:
ok Correct!
Test #17:
score: 0
Accepted
time: 3ms
memory: 2344kb
input:
1000 203 307 134 54 891 392 567 161 179 563 175 184 863 89 54 537 563 34 97 207 517 286 750 517 195 63 477 468 168 863 338 193 455 120 60 584 135 197 159 667 834 154 533 191 392 142 715 218 96 609 25 492 295 57 347 263 289 359 290 617 146 616 111 528 179 714 910 233 180 251 134 692 365 78 157 386 26...
output:
8964 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61...
result:
ok Correct!
Test #18:
score: 0
Accepted
time: 4ms
memory: 2408kb
input:
1000 359 29 135 514 371 700 67 651 167 555 476 413 215 19 110 225 289 13 46 616 762 42 547 218 26 573 674 109 454 894 215 591 42 13 361 304 128 201 576 392 54 111 425 119 344 260 252 484 51 492 572 207 372 183 745 560 684 294 270 97 278 38 223 282 120 273 630 294 625 752 818 203 417 113 191 811 902 ...
output:
8900 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61...
result:
ok Correct!
Test #19:
score: 0
Accepted
time: 3ms
memory: 2432kb
input:
1000 672 331 438 653 624 242 641 619 51 548 649 796 172 324 106 792 16 147 307 248 86 699 223 11 633 239 340 473 526 145 25 83 13 586 329 97 494 63 279 119 158 103 7 411 44 123 520 597 546 182 90 558 79 1 765 330 285 278 137 464 15 676 171 224 569 493 578 508 206 286 132 41 2 628 93 111 305 15 215 3...
output:
9002 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61...
result:
ok Correct!
Test #20:
score: 0
Accepted
time: 4ms
memory: 2364kb
input:
1000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...
output:
9977 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61...
result:
ok Correct!
Test #21:
score: 0
Accepted
time: 1ms
memory: 2180kb
input:
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
output:
1999 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 61...
result:
ok Correct!
Test #22:
score: 0
Accepted
time: 0ms
memory: 2100kb
input:
1000 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0
result:
ok Correct!
Extra Test:
score: 0
Extra Test Passed