#![allow(non_snake_case, unused_imports, unused_must_use)] use std::io::{self, prelude::*}; use std::str; fn main() { let (stdin, stdout) = (io::stdin(), io::stdout()); let mut scan = Scanner::new(stdin.lock()); let mut out = io::BufWriter::new(stdout.lock()); macro_rules! input { ($T: ty) => { scan.token::<$T>() }; ($T: ty, $N: expr) => { (0..$N).map(|_| scan.token::<$T>()).collect::>() }; } let N = input!(usize); let M = input!(usize); let X = input!(isize, M); let mut C = vec![]; let mut T = vec![]; let mut cards = vec![]; for i in 0..N { let c = input!(isize, M); let t = input!(isize); let z = c.iter().map(|&v| v * t).collect::>(); C.push(c); T.push(t); cards.push((z, i)); } cards.sort(); // for c in cards.iter() { // writeln!(out, "order: {}", c.1); // } // 表が i だとして裏を決めたい for i in 0..N { let t = T[i]; let c = &C[i]; let mut LR = vec![]; let mut ok = 0; let mut ng = N; for j in 0..M { let cj = c[j]; let xj = X[j]; let left = 100 - t; let right = 10000 * xj - 100 * t * cj; { let mut okl = ok; let mut okr = ng; if !cards[okl].0[j] * left <= right { while okr - okl > 1 { let m = (okl + okr) / 2; let c = cards[m].0[j]; // c * left <= right を満たす範囲の下限が知りたい if c * left <= right { okl = m; } else { okr = m; } } ok = okl; } } { let mut ngl = ok; let mut ngr = ng; if !cards[ngl].0[j] * left > right { while ngr - ngl > 1 { let m = (ngl + ngr) / 2; let c = cards[m].0[j]; if c * left <= right { ngl = m; } else { ngr = m; } } ng = ngr; } } LR.push((left, right)); } for j in ok..ng { if cards[j].1 != i { let mut isok = true; for k in 0..M { let (left, right) = LR[k]; if left * cards[j].0[k] != right { isok = false; } } if isok { writeln!(out, "Yes"); return; } } } } writeln!(out, "No"); } struct Scanner { reader: R, buf_str: Vec, buf_iter: str::SplitWhitespace<'static>, } impl Scanner { fn new(reader: R) -> Self { Self { reader, buf_str: vec![], buf_iter: "".split_whitespace(), } } fn token(&mut self) -> T { loop { if let Some(token) = self.buf_iter.next() { return token.parse().ok().expect("Failed parse"); } self.buf_str.clear(); self.reader .read_until(b'\n', &mut self.buf_str) .expect("Failed read"); self.buf_iter = unsafe { let slice = str::from_utf8_unchecked(&self.buf_str); std::mem::transmute(slice.split_whitespace()) } } } }