結果
問題 | No.2175 Exciting Combo |
ユーザー |
![]() |
提出日時 | 2023-01-06 23:26:48 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 2,134 bytes |
コンパイル時間 | 13,188 ms |
コンパイル使用メモリ | 379,688 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 20:19:04 |
合計ジャッジ時間 | 13,653 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
pub mod input {use std::io::{BufRead, ErrorKind};pub trait ReadBytes {fn read_bytes(&mut self) -> Vec<u8>;}impl<R: BufRead> ReadBytes for R {#[inline]fn read_bytes(&mut self) -> Vec<u8> {let mut res = Vec::new();loop {let buf = match self.fill_buf() {Ok(buf) => buf,Err(e) if e.kind() == ErrorKind::Interrupted => continue,Err(e) => panic!("{}", e),};let (done, used, buf) = match buf.iter().position(u8::is_ascii_whitespace) {Some(i) => (i > 0 || res.len() > 0, i + 1, &buf[..i]),None => (buf.is_empty(), buf.len(), buf),};res.extend_from_slice(buf);self.consume(used);if done {return res;}}}}#[macro_export]macro_rules! read {($r:expr, [$t:tt; $n:expr]) => ((0..$n).map(|_| read!($r, $t)).collect::<Vec<_>>());($r:expr, [$t:tt]) => (read!($r, [$t; read!($r, usize)]));($r:expr, ($($t:tt),*)) => (($(read!($r, $t)),*));($r:expr, Usize1) => (read!($r, usize) - 1);($r:expr, String) => (String::from_utf8(read!($r, Bytes)).unwrap());($r:expr, Bytes) => ($r.read_bytes());($r:expr, $t:ty) => (read!($r, String).parse::<$t>().unwrap());}#[macro_export]macro_rules! input {($r:expr, $($($v:ident)* : $t:tt),* $(,)?) => {$(let $($v)* = read!($r, $t);)*};}}use input::ReadBytes;fn run<R: std::io::BufRead, W: std::io::Write>(reader: &mut R, _writer: &mut W) {input! {reader,a: [u32; 3], b: u32,}let ans = (a[2] * 3).max(a.iter().sum::<u32>() + b);println!("{}", ans);}fn main() {let (stdin, stdout) = (std::io::stdin(), std::io::stdout());let mut reader = std::io::BufReader::new(stdin.lock());let mut writer = std::io::BufWriter::new(stdout.lock());run(&mut reader, &mut writer);}