#![allow(unused_imports, non_snake_case, dead_code)] pub use __cargo_equip::prelude::*; use kyopro_grid::P; use kyopro_io::get; use kyopro_utils::*; use std::collections::BTreeSet; use std::mem::swap; use std::ops::{Index, IndexMut}; use std::{ cmp::max, collections::BTreeMap, io::{StdoutLock, Write}, }; const N: usize = 50; const M: usize = 20; struct Bomb { C: usize, L: usize, ab: Vec<(i32, i32)>, } struct Input { A: Vec>, bs: Vec, shops: Vec

, } fn read_input() -> Input { let _ = get!(usize, usize); let A = (0..N).map(|_| get!(String).chars().collect::>()).collect::>(); let mut bs = vec![]; for _ in 0..M { let (c, l) = get!(usize, usize); let mut ab = vec![]; for _ in 0..l { let (a, b) = get!(i32, i32); ab.push((a, b)); } bs.push(Bomb { C: c, L: l, ab }); } let mut shops = vec![]; for i in 0..N { for j in 0..N { if A[i][j] == '@' { shops.push(P(i, j)); } } } Input { A, bs, shops } } fn greedy(inp: &Input) { let FN = 10; } fn main() { let stdout = std::io::stdout(); let mut writer = std::io::BufWriter::new(stdout.lock()); let inp = read_input(); writeln!(writer, "1").unwrap(); writeln!(writer, "1 D").unwrap(); } // The following code was expanded by `cargo-equip`. /// # Bundled libraries /// /// - `kyopro-grid 0.1.0 (path+██████████████████████████████████████████████████)` published in **missing** licensed under `CC0-1.0` as `crate::__cargo_equip::crates::kyopro_grid` /// - `kyopro-io 0.1.0 (path+████████████████████████████████████████████████)` published in **missing** licensed under `CC0-1.0` as `crate::__cargo_equip::crates::kyopro_io` /// - `kyopro-utils 0.1.0 (path+███████████████████████████████████████████████████)` published in **missing** licensed under `CC0-1.0` as `crate::__cargo_equip::crates::kyopro_utils` #[cfg_attr(any(), rustfmt::skip)] #[allow(unused)] mod __cargo_equip { pub(crate) mod crates { pub mod kyopro_grid {use std::ops::{Index,IndexMut};pub const D4:[P;4]=[P(1,0),P(0,1),P(!0,0),P(0,!0)];#[derive(Clone,Copy,PartialEq,Eq,Debug)]pub struct P(pub usize,pub usize);impl P{pub fn adj4(self)->impl Iterator{D4.iter().map(move|&d|self.add(&P(d.0,d.1)))}pub fn add(self,rhs:&P)->P{P(self.0.wrapping_add(rhs.0),self.1.wrapping_add(rhs.1))}}implIndex

for Vec>{type Output=T;fn index(&self,p:P)->&T{&self[p.0][p.1]}}implIndexMut

for Vec>{fn index_mut(&mut self,p:P)->&mut T{&mut self[p.0][p.1]}}pub struct Grid{h:usize,w:usize,g:Vec>,}implGridwhere T:Copy,{pub fn from(g:&Vec>)->Self{Grid{h:g.len(),w:g[0].len(),g:g.clone(),}}#[allow(non_snake_case)]pub fn new(h:usize,w:usize,I:T)->Self{let g=vec![vec![I;w];h];Grid{h,w,g}}}implGrid{pub fn adj4<'a>(&'a self,p:P)->impl Iterator+'a{D4.iter().map(move|&d|p.add(&P(d.0,d.1))).filter(|&p|p.0(&'a self,b:P,offsets:&'a[P])->impl Iterator+'a{let x=offsets.iter().map(move|&d|P(b.0.wrapping_add(d.0),b.1.wrapping_add(d.1)));x.filter(|&p|p.0Option

{let x=b.add(&offset);if self.is_valid_position(&x){Some(x)}else{None}}pub fn is_valid_position(&self,p:&P)->bool{p.0Indexfor Grid{type Output=[T];#[inline]fn index(&self,idx:usize)->&[T]{&self.g[idx]}}implIndexMutfor Grid{#[inline]fn index_mut(&mut self,idx:usize)->&mut[T]{&mut self.g[idx]}}implIndex

for Grid{type Output=T;#[inline]fn index(&self,idx:P)->&T{&self.g[idx.0][idx.1]}}implIndexMut

for Grid{#[inline]fn index_mut(&mut self,p:P)->&mut T{&mut self.g[p.0][p.1]}}} pub mod kyopro_io {pub use crate::__cargo_equip::macros::kyopro_io::*;#[macro_export]macro_rules!__cargo_equip_macro_def_kyopro_io_get{($t:ty)=>{{let mut line:String=String::new();std::io::stdin().read_line(&mut line).unwrap();line.trim().parse::<$t>().unwrap()}};($($t:ty),*)=>{{let mut line:String=String::new();std::io::stdin().read_line(&mut line).unwrap();let mut iter=line.split_whitespace();($(iter.next().unwrap().parse::<$t>().unwrap(),)*)}};($t:ty;$n:expr)=>{(0..$n).map(|_|get!($t)).collect::>()};($($t:ty),*;$n:expr)=>{(0..$n).map(|_|get!($($t),*)).collect::>()};($t:ty;;)=>{{let mut line:String=String::new();std::io::stdin().read_line(&mut line).unwrap();line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::>()}};($t:ty;;$n:expr)=>{(0..$n).map(|_|get!($t;;)).collect::>()};}macro_rules!get{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_kyopro_io_get!{$($tt)*})}} pub mod kyopro_utils {pub use crate::__cargo_equip::macros::kyopro_utils::*;use std::ops::{Add,Rem};#[macro_export]macro_rules!__cargo_equip_macro_def_kyopro_utils_mat{($($e:expr),*)=>{Vec::from(vec![$($e),*])};($($e:expr,)*)=>{Vec::from(vec![$($e),*])};($e:expr;$d:expr)=>{Vec::from(vec![$e;$d])};($e:expr;$d:expr$(;$ds:expr)+)=>{Vec::from(vec![mat![$e$(;$ds)*];$d])};}macro_rules!mat{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_kyopro_utils_mat!{$($tt)*})}#[macro_export]macro_rules!__cargo_equip_macro_def_kyopro_utils_echo{($($num:expr),*)=>{let mut tmp=vec![];$(tmp.push(format!("{}",$num));)*println!("{}",tmp.join(" "));};}macro_rules!echo{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_kyopro_utils_echo!{$($tt)*})}#[macro_export]macro_rules!__cargo_equip_macro_def_kyopro_utils_YesNo{($num:expr)=>{if($num)as i64==0{println!("No");}else{println!("Yes");}};}macro_rules!YesNo{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_kyopro_utils_YesNo!{$($tt)*})}#[macro_export]macro_rules!__cargo_equip_macro_def_kyopro_utils_Yes{()=>{println!("Yes");};}macro_rules!Yes{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_kyopro_utils_Yes!{$($tt)*})}#[macro_export]macro_rules!__cargo_equip_macro_def_kyopro_utils_No{()=>{println!("No");};}macro_rules!No{($($tt:tt)*)=>(crate::__cargo_equip_macro_def_kyopro_utils_No!{$($tt)*})}pub trait SetMinMax{fn setmin(&mut self,v:Self)->bool;fn setmax(&mut self,v:Self)->bool;}implSetMinMax for T where T:PartialOrd,{fn setmin(&mut self,v:T)->bool{*self>v&&{*self=v;true}}fn setmax(&mut self,v:T)->bool{*self(v:&[T])where T:std::fmt::Display,{for i in 0..v.len(){print!("{}{}",v[i],if i+1==v.len(){""}else{" "});}println!();}pub fn pmod+Rem>(x:T,m:T)->T{((x%m)+m)%m}pub fn lower_bound(a:&[T],x:&T)->usize where T:Ord,{if a.len()==0||a[0]>=*x{return 0;}let mut l=0;let mut r=a.len();while l+1(a:&[T],x:&T)->usize where T:Ord,{if a.len()==0||a[0]>*x{return 0;}let mut l=0;let mut r=a.len();while l+1