Submission #61544865
Source Code Expand
#[allow(unused_imports)]
use proconio::input;
fn main() {
input!{
n: usize,
d: u64,
v: [(u64, u64); n],
}
for i in 1..=d {
println!("{}", v.iter().map(|&(t, d)| t*(d+i)).max().unwrap());
}
}
pub trait Debuggable {
fn debug_string(&self) -> String;
}
impl<T: std::fmt::Debug + std::fmt::Display> Debuggable for Vec<T> {
fn debug_string(&self) -> String {
use itertools::Itertools;
use std::iter::repeat;
if let Some(max_size) = self.iter()
.enumerate()
.map(|(i, x)| (format!("{:?}", x).len()).max(format!("{:?}", i).len()))
.max() {
let mut idx = String::from("idx |");
let mut val = String::from("val |");
for (i, xi) in self.iter().enumerate() {
idx.push_str(
&format!(" {:>w$} |", i, w=max_size)
);
val.push_str(
&format!(" {:>w$} |", xi, w=max_size)
);
}
format!("{}\n{}\n{}\n", idx, repeat('-').take(idx.len()).join(""), val)
} else {
format!("idx | \nval |\n")
}
}
}
impl<T: std::fmt::Debug + std::fmt::Display> Debuggable for std::collections::BTreeSet<T> {
fn debug_string(&self) -> String {
use itertools::Itertools;
format!("{{ {} }}", self.iter().join(", "))
}
}
impl<T, U> Debuggable for std::collections::BTreeMap<T, U>
where T: std::fmt::Debug + std::fmt::Display, U: std::fmt::Debug + std::fmt::Display
{
fn debug_string(&self) -> String {
use itertools::Itertools;
format!(
"{{\n{}\n }}", self.iter()
.map(|(k, v)| format!("{k} -> {v}, "))
.join("\n")
)
}
}
// lg! マクロの定義
#[macro_export]
macro_rules! lg {
($val:expr) => {
#[cfg(feature = "local")]
{
{
use Debuggable;
let val = &$val;
eprintln!(
"[{}:{}] {} = \n{}",
file!(),
line!(),
stringify!($val),
val.debug_string()
);
val
}
}
}
}
Submission Info
Submission Time |
|
Task |
B - Heavy Snake |
User |
ardRiriy |
Language |
Rust (rustc 1.70.0) |
Score |
200 |
Code Size |
2339 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
2080 KiB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample00.txt, sample01.txt |
All |
sample00.txt, sample01.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt |
Case Name |
Status |
Exec Time |
Memory |
sample00.txt |
AC |
1 ms |
1928 KiB |
sample01.txt |
AC |
1 ms |
1932 KiB |
testcase00.txt |
AC |
1 ms |
1920 KiB |
testcase01.txt |
AC |
1 ms |
1940 KiB |
testcase02.txt |
AC |
1 ms |
1732 KiB |
testcase03.txt |
AC |
1 ms |
1940 KiB |
testcase04.txt |
AC |
1 ms |
2080 KiB |
testcase05.txt |
AC |
1 ms |
1944 KiB |
testcase06.txt |
AC |
1 ms |
1996 KiB |
testcase07.txt |
AC |
1 ms |
1936 KiB |
testcase08.txt |
AC |
1 ms |
1904 KiB |
testcase09.txt |
AC |
1 ms |
1936 KiB |
testcase10.txt |
AC |
1 ms |
2000 KiB |
testcase11.txt |
AC |
1 ms |
1976 KiB |