#![allow(unused_must_use, non_snake_case)] use std::io::{stdin, stdout, BufWriter, Write}; fn main() { let mut scan = Scanner::default(); macro_rules! input { ($T: ty) => { scan.next::<$T>() }; ($T: ty, $N: expr) => { (0..$N).map(|_| scan.next::<$T>()).collect::>() }; } let T = input!(usize); let N = input!(usize); let mut M = input!(usize); let mut S = vec![]; let mut P = vec![]; let mut R = vec![]; let g = 2; { let out = &mut BufWriter::new(stdout()); writeln!(out, "2 {}", g); } { M = input!(usize); S = input!(usize, N); P = input!(isize, N); R = input!(usize, N); } // とりあえず一日に使えるお金を均等にしてみる let C = M / (500 * (T - 1)); for _ in 0..T - 1 { // output if S.is_empty() { let out = &mut BufWriter::new(stdout()); writeln!( out, "1 {}", vec![C / N; N] .iter() .map(|x| x.to_string()) .collect::>() .join(" ") ); } else { let out = &mut BufWriter::new(stdout()); let sum_of_weight = P.iter().map(|&p| if p >= 0 { p } else { 0 }).sum::(); assert!(sum_of_weight > 0); let L = (0..N) .map(|i| C * (if P[i] >= 0 { P[i] } else { 0 }) as usize / sum_of_weight as usize) .collect::>(); writeln!( out, "1 {}", L.iter() .map(|x| x.to_string()) .collect::>() .join(" ") ); } // input { M = input!(usize); S = input!(usize, N); P = input!(isize, N); R = input!(usize, N); } } } #[derive(Default)] struct Scanner { buffer: Vec, } impl Scanner { fn next(&mut self) -> T { loop { if let Some(token) = self.buffer.pop() { return token.parse().ok().expect("Failed parse"); } let mut input = String::new(); stdin().read_line(&mut input).expect("Failed read"); self.buffer = input.split_whitespace().rev().map(String::from).collect(); } } }