QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#871001#8623. Metaucup-team296#AC ✓0ms2304kbRust21.9kb2025-01-25 19:03:332025-01-25 19:03:33

Judging History

你现在查看的是最新测评结果

  • [2025-01-25 19:03:33]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:2304kb
  • [2025-01-25 19:03:33]
  • 提交

answer

// https://contest.ucup.ac/contest/1901/problem/8623
use crate::algo_lib::collections::min_max::MinimMaxim;
use crate::algo_lib::io::input::Input;
use crate::algo_lib::io::output::Output;
use crate::algo_lib::misc::test_type::TaskType;
use crate::algo_lib::misc::test_type::TestType;
use crate::algo_lib::string::str::Str;
type PreCalc = ();
fn solve(input: &mut Input, out: &mut Output, _test_case: usize, _data: &mut PreCalc) {
    let n = input.read_size();
    let tasks: Vec<(Str, i32, i32, i32)> = input.read_vec(n);
    let mut times = Vec::new();
    for (_, a, b, c) in tasks {
        let mut cur = None;
        if a != -1 {
            cur.minim(a);
        }
        if b != -1 {
            cur.minim(b);
        }
        if c != -1 {
            cur.minim(c);
        }
        if let Some(cur) = cur {
            times.push(cur);
        }
    }
    times.sort_unstable();
    let mut rem = 300;
    let mut solved = 0;
    for t in times {
        if t > rem {
            break;
        }
        rem -= t;
        solved += 1;
    }
    out.print_line(solved);
}
pub static TEST_TYPE: TestType = TestType::Single;
pub static TASK_TYPE: TaskType = TaskType::Classic;
pub(crate) fn run(mut input: Input, mut output: Output) -> bool {
    let mut pre_calc = ();
    match TEST_TYPE {
        TestType::Single => solve(&mut input, &mut output, 1, &mut pre_calc),
        TestType::MultiNumber => {
            let t = input.read();
            for i in 1..=t {
                solve(&mut input, &mut output, i, &mut pre_calc);
            }
        }
        TestType::MultiEof => {
            let mut i = 1;
            while input.peek().is_some() {
                solve(&mut input, &mut output, i, &mut pre_calc);
                i += 1;
            }
        }
    }
    output.flush();
    match TASK_TYPE {
        TaskType::Classic => input.is_empty(),
        TaskType::Interactive => true,
    }
}


fn main() {
    let input = crate::algo_lib::io::input::Input::stdin();
    let output = crate::algo_lib::io::output::Output::stdout();
    run(input, output);
}
pub mod algo_lib {
pub mod collections {
pub mod min_max {
pub trait MinimMaxim<Rhs = Self>: PartialOrd + Sized {
    fn minim(&mut self, other: Rhs) -> bool;
    fn maxim(&mut self, other: Rhs) -> bool;
}
impl<T: PartialOrd> MinimMaxim for T {
    fn minim(&mut self, other: Self) -> bool {
        if other < *self {
            *self = other;
            true
        } else {
            false
        }
    }
    fn maxim(&mut self, other: Self) -> bool {
        if other > *self {
            *self = other;
            true
        } else {
            false
        }
    }
}
impl<T: PartialOrd> MinimMaxim<T> for Option<T> {
    fn minim(&mut self, other: T) -> bool {
        match self {
            None => {
                *self = Some(other);
                true
            }
            Some(v) => v.minim(other),
        }
    }
    fn maxim(&mut self, other: T) -> bool {
        match self {
            None => {
                *self = Some(other);
                true
            }
            Some(v) => v.maxim(other),
        }
    }
}
}
}
pub mod io {
pub mod input {
use std::fs::File;
use std::io::{Read, Stdin};
use std::mem::MaybeUninit;
enum InputSource {
    Stdin(Stdin),
    File(File),
    Slice,
    Delegate(Box<dyn Read + Send>),
}
pub struct Input {
    input: InputSource,
    buf: Vec<u8>,
    at: usize,
    buf_read: usize,
    eol: bool,
}
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 Input {
    const DEFAULT_BUF_SIZE: usize = 4096;
    pub fn slice(input: &[u8]) -> Self {
        Self {
            input: InputSource::Slice,
            buf: input.to_vec(),
            at: 0,
            buf_read: input.len(),
            eol: true,
        }
    }
    pub fn stdin() -> Self {
        Self {
            input: InputSource::Stdin(std::io::stdin()),
            buf: vec![0; Self::DEFAULT_BUF_SIZE],
            at: 0,
            buf_read: 0,
            eol: true,
        }
    }
    pub fn file(file: File) -> Self {
        Self {
            input: InputSource::File(file),
            buf: vec![0; Self::DEFAULT_BUF_SIZE],
            at: 0,
            buf_read: 0,
            eol: true,
        }
    }
    pub fn delegate(reader: impl Read + Send + 'static) -> Self {
        Self {
            input: InputSource::Delegate(Box::new(reader)),
            buf: vec![0; Self::DEFAULT_BUF_SIZE],
            at: 0,
            buf_read: 0,
            eol: true,
        }
    }
    pub fn get(&mut self) -> Option<u8> {
        if self.refill_buffer() {
            let res = self.buf[self.at];
            self.at += 1;
            if res == b'\r' {
                self.eol = true;
                if self.refill_buffer() && self.buf[self.at] == b'\n' {
                    self.at += 1;
                }
                return Some(b'\n');
            }
            self.eol = res == b'\n';
            Some(res)
        } else {
            None
        }
    }
    pub fn peek(&mut self) -> Option<u8> {
        if self.refill_buffer() {
            let res = self.buf[self.at];
            Some(if res == b'\r' { b'\n' } else { res })
        } else {
            None
        }
    }
    pub fn skip_whitespace(&mut self) {
        while let Some(b) = self.peek() {
            if !b.is_ascii_whitespace() {
                return;
            }
            self.get();
        }
    }
    pub fn next_token(&mut self) -> Option<Vec<u8>> {
        self.skip_whitespace();
        let mut res = Vec::new();
        while let Some(c) = self.get() {
            if c.is_ascii_whitespace() {
                break;
            }
            res.push(c);
        }
        if res.is_empty() { None } else { Some(res) }
    }
    pub fn is_exhausted(&mut self) -> bool {
        self.peek().is_none()
    }
    pub fn is_empty(&mut self) -> bool {
        self.skip_whitespace();
        self.is_exhausted()
    }
    pub fn read<T: Readable>(&mut self) -> T {
        T::read(self)
    }
    pub fn read_vec<T: Readable>(&mut self, size: usize) -> Vec<T> {
        let mut res = Vec::with_capacity(size);
        for _ in 0..size {
            res.push(self.read());
        }
        res
    }
    pub fn read_char(&mut self) -> u8 {
        self.skip_whitespace();
        self.get().unwrap()
    }
    read_impl!(u32, read_unsigned, read_unsigned_vec);
    read_impl!(u64, read_u64, read_u64_vec);
    read_impl!(usize, read_size, read_size_vec, read_size_pair_vec);
    read_impl!(i32, read_int, read_int_vec, read_int_pair_vec);
    read_impl!(i64, read_long, read_long_vec, read_long_pair_vec);
    read_impl!(i128, read_i128, read_i128_vec);
    fn refill_buffer(&mut self) -> bool {
        if self.at == self.buf_read {
            self.at = 0;
            self.buf_read = match &mut self.input {
                InputSource::Stdin(stdin) => stdin.read(&mut self.buf).unwrap(),
                InputSource::File(file) => file.read(&mut self.buf).unwrap(),
                InputSource::Delegate(reader) => reader.read(&mut self.buf).unwrap(),
                InputSource::Slice => 0,
            };
            self.buf_read != 0
        } else {
            true
        }
    }
    pub fn is_eol(&self) -> bool {
        self.eol
    }
}
pub trait Readable {
    fn read(input: &mut Input) -> Self;
}
impl Readable for u8 {
    fn read(input: &mut Input) -> Self {
        input.read_char()
    }
}
impl<T: Readable> Readable for Vec<T> {
    fn read(input: &mut Input) -> Self {
        let size = input.read();
        input.read_vec(size)
    }
}
impl<T: Readable, const SIZE: usize> Readable for [T; SIZE] {
    fn read(input: &mut Input) -> Self {
        unsafe {
            let mut res = MaybeUninit::<[T; SIZE]>::uninit();
            for i in 0..SIZE {
                let ptr: *mut T = (*res.as_mut_ptr()).as_mut_ptr();
                ptr.add(i).write(input.read::<T>());
            }
            res.assume_init()
        }
    }
}
macro_rules! read_integer {
    ($($t:ident)+) => {
        $(impl Readable for $t { fn read(input : & mut Input) -> Self { input
        .skip_whitespace(); let mut c = input.get().unwrap(); let sgn = match c { b'-' =>
        { c = input.get().unwrap(); true } b'+' => { c = input.get().unwrap(); false } _
        => false, }; let mut res = 0; loop { assert!(c.is_ascii_digit()); res *= 10; let
        d = (c - b'0') as $t; if sgn { res -= d; } else { res += d; } match input.get() {
        None => break, Some(ch) => { if ch.is_ascii_whitespace() { break; } else { c =
        ch; } } } } res } })+
    };
}
read_integer!(i8 i16 i32 i64 i128 isize u16 u32 u64 u128 usize);
macro_rules! tuple_readable {
    ($($name:ident)+) => {
        impl <$($name : Readable),+> Readable for ($($name,)+) { fn read(input : & mut
        Input) -> Self { ($($name ::read(input),)+) } }
    };
}
tuple_readable! {
    T
}
tuple_readable! {
    T U
}
tuple_readable! {
    T U V
}
tuple_readable! {
    T U V X
}
tuple_readable! {
    T U V X Y
}
tuple_readable! {
    T U V X Y Z
}
tuple_readable! {
    T U V X Y Z A
}
tuple_readable! {
    T U V X Y Z A B
}
tuple_readable! {
    T U V X Y Z A B C
}
tuple_readable! {
    T U V X Y Z A B C D
}
tuple_readable! {
    T U V X Y Z A B C D E
}
tuple_readable! {
    T U V X Y Z A B C D E F
}
}
pub mod output {
use std::cmp::Reverse;
use std::fs::File;
use std::io::{Stdout, 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,
        }
    }
}
enum OutputDest<'s> {
    Stdout(Stdout),
    File(File),
    Buf(&'s mut Vec<u8>),
    Delegate(Box<dyn Write + 's>),
}
pub struct Output<'s> {
    output: OutputDest<'s>,
    buf: Vec<u8>,
    at: usize,
    bool_output: BoolOutput,
    precision: Option<usize>,
    separator: u8,
}
impl<'s> Output<'s> {
    pub fn buf(buf: &'s mut Vec<u8>) -> Self {
        Self::new(OutputDest::Buf(buf))
    }
    pub fn delegate(delegate: impl Write + 'static) -> Self {
        Self::new(OutputDest::Delegate(Box::new(delegate)))
    }
    fn new(output: OutputDest<'s>) -> Self {
        Self {
            output,
            buf: vec![0; Self::DEFAULT_BUF_SIZE],
            at: 0,
            bool_output: BoolOutput::YesNoCaps,
            precision: None,
            separator: b' ',
        }
    }
}
impl Output<'static> {
    pub fn stdout() -> Self {
        Self::new(OutputDest::Stdout(std::io::stdout()))
    }
    pub fn file(file: File) -> Self {
        Self::new(OutputDest::File(file))
    }
}
impl Output<'_> {
    const DEFAULT_BUF_SIZE: usize = 4096;
    pub fn flush(&mut self) {
        if self.at != 0 {
            match &mut self.output {
                OutputDest::Stdout(stdout) => {
                    stdout.write_all(&self.buf[..self.at]).unwrap();
                    stdout.flush().unwrap();
                }
                OutputDest::File(file) => {
                    file.write_all(&self.buf[..self.at]).unwrap();
                    file.flush().unwrap();
                }
                OutputDest::Buf(buf) => buf.extend_from_slice(&self.buf[..self.at]),
                OutputDest::Delegate(delegate) => {
                    delegate.write_all(&self.buf[..self.at]).unwrap();
                    delegate.flush().unwrap();
                }
            }
            self.at = 0;
        }
    }
    pub fn print<T: Writable>(&mut self, s: T) {
        s.write(self);
    }
    pub fn print_line<T: Writable>(&mut self, s: T) {
        self.print(s);
        self.put(b'\n');
    }
    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 print_per_line<T: Writable>(&mut self, arg: &[T]) {
        self.print_per_line_iter(arg.iter());
    }
    pub fn print_iter<T: Writable, I: Iterator<Item = T>>(&mut self, iter: I) {
        let mut first = true;
        for e in iter {
            if first {
                first = false;
            } else {
                self.put(self.separator);
            }
            e.write(self);
        }
    }
    pub fn print_line_iter<T: Writable, I: Iterator<Item = T>>(&mut self, iter: I) {
        self.print_iter(iter);
        self.put(b'\n');
    }
    pub fn print_per_line_iter<T: Writable, I: Iterator<Item = T>>(&mut self, iter: I) {
        for e in iter {
            e.write(self);
            self.put(b'\n');
        }
    }
    pub fn set_bool_output(&mut self, bool_output: BoolOutput) {
        self.bool_output = bool_output;
    }
    pub fn set_precision(&mut self, precision: usize) {
        self.precision = Some(precision);
    }
    pub fn reset_precision(&mut self) {
        self.precision = None;
    }
    pub fn get_precision(&self) -> Option<usize> {
        self.precision
    }
    pub fn separator(&self) -> u8 {
        self.separator
    }
    pub fn set_separator(&mut self, separator: u8) {
        self.separator = separator;
    }
}
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;
        }
        Ok(buf.len())
    }
    fn flush(&mut self) -> std::io::Result<()> {
        self.flush();
        Ok(())
    }
}
pub trait Writable {
    fn write(&self, output: &mut Output);
}
impl Writable for &str {
    fn write(&self, output: &mut Output) {
        output.write_all(self.as_bytes()).unwrap();
    }
}
impl Writable for String {
    fn write(&self, output: &mut Output) {
        output.write_all(self.as_bytes()).unwrap();
    }
}
impl Writable for char {
    fn write(&self, output: &mut Output) {
        output.put(*self as u8);
    }
}
impl Writable for u8 {
    fn write(&self, output: &mut Output) {
        output.put(*self);
    }
}
impl<T: Writable> Writable for [T] {
    fn write(&self, output: &mut Output) {
        output.print_iter(self.iter());
    }
}
impl<T: Writable, const N: usize> Writable for [T; N] {
    fn write(&self, output: &mut Output) {
        output.print_iter(self.iter());
    }
}
impl<T: Writable + ?Sized> Writable for &T {
    fn write(&self, output: &mut Output) {
        T::write(self, output)
    }
}
impl<T: Writable> Writable for Vec<T> {
    fn write(&self, output: &mut Output) {
        self.as_slice().write(output);
    }
}
impl Writable for () {
    fn write(&self, _output: &mut Output) {}
}
macro_rules! write_to_string {
    ($($t:ident)+) => {
        $(impl Writable for $t { fn write(& self, output : & mut Output) { self
        .to_string().write(output); } })+
    };
}
write_to_string!(u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize);
macro_rules! tuple_writable {
    ($name0:ident $($name:ident : $id:tt)*) => {
        impl <$name0 : Writable, $($name : Writable,)*> Writable for ($name0, $($name,)*)
        { fn write(& self, out : & mut Output) { self.0.write(out); $(out.put(out
        .separator); self.$id .write(out);)* } }
    };
}
tuple_writable! {
    T
}
tuple_writable! {
    T U : 1
}
tuple_writable! {
    T U : 1 V : 2
}
tuple_writable! {
    T U : 1 V : 2 X : 3
}
tuple_writable! {
    T U : 1 V : 2 X : 3 Y : 4
}
tuple_writable! {
    T U : 1 V : 2 X : 3 Y : 4 Z : 5
}
tuple_writable! {
    T U : 1 V : 2 X : 3 Y : 4 Z : 5 A : 6
}
tuple_writable! {
    T U : 1 V : 2 X : 3 Y : 4 Z : 5 A : 6 B : 7
}
tuple_writable! {
    T U : 1 V : 2 X : 3 Y : 4 Z : 5 A : 6 B : 7 C : 8
}
impl<T: Writable> Writable for Option<T> {
    fn write(&self, output: &mut Output) {
        match self {
            None => (-1).write(output),
            Some(t) => t.write(output),
        }
    }
}
impl Writable for bool {
    fn write(&self, output: &mut Output) {
        let bool_output = output.bool_output;
        bool_output.output(output, *self)
    }
}
impl<T: Writable> Writable for Reverse<T> {
    fn write(&self, output: &mut Output) {
        self.0.write(output);
    }
}
}
}
pub mod misc {
pub mod test_type {
pub enum TestType {
    Single,
    MultiNumber,
    MultiEof,
}
pub enum TaskType {
    Classic,
    Interactive,
}
}
pub mod transparent_wrapper {
#[macro_export]
macro_rules! transparent_wrapper {
    ($name:ident $(<$($par:ident $(,)?)+>)? = $t:ty $(, derive $($d:ty $(,)?)+)?) => {
        $(#[derive($($d,)+)])? pub struct $name $(<$($par,)+>)? ($t); impl
        $(<$($par,)+>)? Deref for $name $(<$($par,)+>)? { type Target = $t; fn deref(&
        self) -> & Self::Target { & self.0 } } impl $(<$($par,)+>)? DerefMut for $name
        $(<$($par,)+>)? { fn deref_mut(& mut self) -> & mut Self::Target { & mut self.0 }
        }
    };
}
}
}
pub mod string {
pub mod str {
use crate::algo_lib::io::input::{Input, Readable};
use crate::algo_lib::io::output::{Output, Writable};
use crate::transparent_wrapper;
use std::fmt::Display;
use std::io::Write;
use std::ops::{AddAssign, Deref, DerefMut};
use std::str::from_utf8_unchecked;
use std::vec::IntoIter;
transparent_wrapper!(
    Str = Vec < u8 >, derive Eq, PartialEq, Hash, PartialOrd, Ord, Clone, Default
);
impl Str {
    pub fn new() -> Self {
        Self(Vec::new())
    }
    pub fn unwrap(self) -> Vec<u8> {
        self.0
    }
}
impl From<Vec<u8>> for Str {
    fn from(v: Vec<u8>) -> Self {
        Self(v)
    }
}
impl From<&[u8]> for Str {
    fn from(v: &[u8]) -> Self {
        Self(v.to_vec())
    }
}
impl<const N: usize> From<&[u8; N]> for Str {
    fn from(v: &[u8; N]) -> Self {
        Self(v.to_vec())
    }
}
impl Readable for Str {
    fn read(input: &mut Input) -> Self {
        let mut res = Vec::new();
        input.skip_whitespace();
        while let Some(c) = input.get() {
            if c.is_ascii_whitespace() {
                break;
            }
            res.push(c);
        }
        Self(res)
    }
}
impl Writable for Str {
    fn write(&self, output: &mut Output) {
        output.write_all(&self.0).unwrap()
    }
}
impl IntoIterator for Str {
    type Item = u8;
    type IntoIter = IntoIter<u8>;
    fn into_iter(self) -> Self::IntoIter {
        self.0.into_iter()
    }
}
impl<'a> IntoIterator for &'a Str {
    type Item = &'a u8;
    type IntoIter = std::slice::Iter<'a, u8>;
    fn into_iter(self) -> Self::IntoIter {
        self.iter()
    }
}
impl<'a> IntoIterator for &'a mut Str {
    type Item = &'a mut u8;
    type IntoIter = std::slice::IterMut<'a, u8>;
    fn into_iter(self) -> Self::IntoIter {
        self.iter_mut()
    }
}
impl FromIterator<u8> for Str {
    fn from_iter<T: IntoIterator<Item = u8>>(iter: T) -> Self {
        Self(iter.into_iter().collect())
    }
}
impl AsRef<[u8]> for Str {
    fn as_ref(&self) -> &[u8] {
        &self.0
    }
}
impl AddAssign<&[u8]> for Str {
    fn add_assign(&mut self, rhs: &[u8]) {
        self.0.extend_from_slice(rhs)
    }
}
impl Display for Str {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        unsafe { f.write_str(from_utf8_unchecked(&self.0)) }
    }
}
pub trait StrReader {
    fn read_str(&mut self) -> Str;
    fn read_str_vec(&mut self, n: usize) -> Vec<Str>;
    fn read_line(&mut self) -> Str;
    fn read_line_vec(&mut self, n: usize) -> Vec<Str>;
    fn read_lines(&mut self) -> Vec<Str>;
}
impl StrReader for Input {
    fn read_str(&mut self) -> Str {
        self.read()
    }
    fn read_str_vec(&mut self, n: usize) -> Vec<Str> {
        self.read_vec(n)
    }
    fn read_line(&mut self) -> Str {
        let mut res = Str::new();
        while let Some(c) = self.get() {
            if self.is_eol() {
                break;
            }
            res.push(c);
        }
        res
    }
    fn read_line_vec(&mut self, n: usize) -> Vec<Str> {
        let mut res = Vec::with_capacity(n);
        for _ in 0..n {
            res.push(self.read_line());
        }
        res
    }
    fn read_lines(&mut self) -> Vec<Str> {
        let mut res = Vec::new();
        while !self.is_exhausted() {
            res.push(self.read_line());
        }
        if let Some(s) = res.last() {
            if s.is_empty() {
                res.pop();
            }
        }
        res
    }
}
}
}
}

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

詳細信息

Test #1:

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

input:

13
AplusB -1 20 -1
TheBestWife 80 90 60
Cardinality 40 50 30
3D 40 -1 70
EqualStrings 25 15 20
FastTreeQueries 120 -1 40
GeoSharding 25 20 30
HaveYouSeenThisSubarray 80 90 60
InteractiveCasino 50 20 30
JigsawPuzzle 40 50 80
Knapsack -1 40 200
LondonUnderground -1 200 40
Meta 5 7 10

output:

10

result:

ok 1 number(s): "10"

Test #2:

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

input:

10
a 30 30 50
b 30 30 50
c 30 30 50
d 30 30 50
e 30 30 50
f 30 30 50
g 30 30 50
h 30 30 50
i 30 30 50
j 30 30 50

output:

10

result:

ok 1 number(s): "10"

Test #3:

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

input:

11
a 30 30 50
b 30 30 50
c 30 30 50
d 30 30 50
e 30 30 50
f 30 30 50
g 30 30 50
h 30 30 50
i 30 30 50
j 30 30 50
k 30 30 50

output:

10

result:

ok 1 number(s): "10"

Test #4:

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

input:

11
a 31 31 50
b 31 31 50
c 31 31 50
d 31 31 50
e 31 31 50
f 31 31 50
g 31 31 50
h 31 31 50
i 31 31 50
j 31 31 50
k 31 31 50

output:

9

result:

ok 1 number(s): "9"

Test #5:

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

input:

1
a -1 -1 -1

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

1
A 300 300 -1

output:

1

result:

ok 1 number(s): "1"

Test #7:

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

input:

12
A 116 -1 36
B 67 106 -1
C 116 -1 15
D -1 -1 91
E 90 74 13
F -1 -1 -1
G 72 18 -1
H 80 -1 128
I 96 148 -1
J -1 82 111
K 77 -1 103
L 58 148 173

output:

7

result:

ok 1 number(s): "7"

Test #8:

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

input:

8
A 142 148 147
B -1 -1 -1
C -1 -1 -1
D -1 -1 -1
E -1 98 39
F -1 -1 52
G -1 215 -1
H 220 -1 -1

output:

3

result:

ok 1 number(s): "3"

Test #9:

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

input:

4
A 42 -1 37
B -1 -1 15
C -1 36 35
D -1 47 -1

output:

4

result:

ok 1 number(s): "4"

Test #10:

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

input:

14
A -1 21 82
B -1 -1 -1
C 81 197 -1
D -1 -1 -1
E -1 -1 -1
F 208 -1 182
G 212 -1 152
H -1 -1 105
I -1 -1 148
J 6 -1 46
K -1 -1 -1
L 191 -1 -1
M -1 36 51
N 48 -1 34

output:

6

result:

ok 1 number(s): "6"

Test #11:

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

input:

6
A -1 -1 44
B -1 21 2
C -1 21 -1
D 48 33 -1
E 44 -1 -1
F 35 15 9

output:

6

result:

ok 1 number(s): "6"

Test #12:

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

input:

6
A 134 124 22
B 5 28 72
C 77 100 41
D 130 137 96
E 0 150 30
F -1 38 -1

output:

6

result:

ok 1 number(s): "6"

Test #13:

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

input:

12
A 36 22 129
B 30 -1 -1
C -1 169 -1
D 43 -1 175
E -1 106 96
F -1 80 103
G 213 -1 -1
H 130 -1 240
I -1 201 -1
J -1 -1 -1
K -1 -1 101
L 130 129 118

output:

5

result:

ok 1 number(s): "5"

Test #14:

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

input:

4
A 36 -1 29
B 20 -1 49
C 11 -1 77
D -1 76 74

output:

4

result:

ok 1 number(s): "4"

Test #15:

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

input:

14
A -1 68 212
B 207 -1 -1
C -1 -1 217
D -1 -1 204
E -1 79 -1
F 67 101 226
G -1 236 217
H -1 -1 72
I 191 55 149
J -1 150 -1
K 41 51 -1
L 152 -1 -1
M 166 -1 174
N -1 -1 38

output:

5

result:

ok 1 number(s): "5"

Test #16:

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

input:

13
A 27 -1 114
B -1 -1 -1
C 48 -1 210
D 137 169 58
E -1 -1 136
F 154 156 -1
G 102 68 79
H 242 -1 234
I 145 -1 -1
J 190 -1 -1
K 33 246 194
L -1 -1 159
M -1 165 111

output:

5

result:

ok 1 number(s): "5"

Test #17:

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

input:

9
A 71 96 93
B -1 -1 20
C -1 -1 -1
D 41 -1 -1
E 83 -1 3
F -1 -1 14
G -1 35 -1
H -1 -1 -1
I 70 -1 -1

output:

7

result:

ok 1 number(s): "7"

Test #18:

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

input:

1
A 40 -1 81

output:

1

result:

ok 1 number(s): "1"

Test #19:

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

input:

7
A -1 -1 41
B 97 26 -1
C -1 49 92
D -1 69 -1
E 29 44 -1
F -1 -1 54
G 36 -1 50

output:

6

result:

ok 1 number(s): "6"

Test #20:

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

input:

7
A -1 142 53
B 93 54 37
C 95 79 -1
D -1 -1 -1
E -1 76 64
F 43 -1 -1
G -1 143 23

output:

6

result:

ok 1 number(s): "6"

Test #21:

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

input:

13
A -1 -1 76
B 272 -1 -1
C -1 73 148
D -1 224 231
E 143 -1 267
F 26 -1 182
G -1 84 -1
H 209 -1 260
I -1 -1 -1
J -1 182 145
K -1 -1 38
L -1 -1 -1
M 158 132 233

output:

5

result:

ok 1 number(s): "5"

Test #22:

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

input:

9
A 107 66 131
B -1 -1 39
C 113 6 94
D 92 34 119
E -1 -1 30
F 17 -1 -1
G 101 -1 -1
H -1 -1 60
I -1 -1 -1

output:

7

result:

ok 1 number(s): "7"

Test #23:

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

input:

1
A 159 -1 140

output:

1

result:

ok 1 number(s): "1"

Test #24:

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

input:

1
A -1 -1 28

output:

1

result:

ok 1 number(s): "1"

Test #25:

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

input:

7
A -1 148 33
B -1 80 2
C 18 -1 -1
D 87 -1 -1
E 150 88 41
F -1 53 99
G 118 153 81

output:

6

result:

ok 1 number(s): "6"

Test #26:

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

input:

1
A -1 41 -1

output:

1

result:

ok 1 number(s): "1"

Test #27:

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

input:

11
A 1 152 -1
B -1 -1 -1
C -1 -1 50
D 61 -1 29
E 47 10 182
F -1 -1 24
G 134 -1 -1
H 28 99 69
I -1 -1 77
J 140 -1 -1
K -1 46 -1

output:

8

result:

ok 1 number(s): "8"

Test #28:

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

input:

3
A 24 -1 -1
B 2 -1 -1
C 23 -1 -1

output:

3

result:

ok 1 number(s): "3"

Test #29:

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

input:

13
A 61 39 -1
B 109 104 158
C -1 -1 97
D 22 80 -1
E -1 73 -1
F 3 123 -1
G -1 69 30
H -1 84 -1
I -1 124 152
J 92 -1 -1
K -1 -1 -1
L 157 -1 -1
M 86 109 -1

output:

6

result:

ok 1 number(s): "6"

Test #30:

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

input:

10
A -1 -1 -1
B 20 11 -1
C 19 -1 -1
D -1 -1 -1
E 17 -1 -1
F -1 11 27
G 4 -1 10
H -1 26 27
I 29 19 -1
J 28 -1 17

output:

8

result:

ok 1 number(s): "8"

Test #31:

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

input:

2
A -1 71 -1
B -1 43 150

output:

2

result:

ok 1 number(s): "2"

Test #32:

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

input:

12
A -1 -1 -1
B -1 -1 32
C 68 211 93
D -1 -1 85
E 33 -1 64
F -1 111 198
G -1 13 -1
H 177 50 77
I 31 -1 -1
J 36 20 3
K 14 -1 197
L 60 51 31

output:

9

result:

ok 1 number(s): "9"

Test #33:

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

input:

8
A 22 -1 -1
B -1 -1 -1
C -1 21 -1
D -1 11 28
E -1 14 61
F 62 49 -1
G 39 24 -1
H 18 6 60

output:

7

result:

ok 1 number(s): "7"

Test #34:

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

input:

4
A 168 143 -1
B -1 -1 136
C 116 67 105
D 41 10 47

output:

3

result:

ok 1 number(s): "3"

Test #35:

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

input:

10
A -1 -1 -1
B 27 51 -1
C -1 -1 -1
D 27 -1 11
E -1 28 -1
F 34 -1 -1
G -1 -1 43
H -1 16 7
I -1 43 -1
J -1 -1 19

output:

8

result:

ok 1 number(s): "8"

Test #36:

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

input:

12
A -1 30 -1
B -1 108 -1
C -1 70 82
D -1 31 65
E 79 120 -1
F 117 79 14
G -1 -1 31
H 114 -1 -1
I 113 11 -1
J -1 25 85
K -1 44 70
L -1 29 123

output:

9

result:

ok 1 number(s): "9"

Extra Test:

score: 0
Extra Test Passed