結果
| 問題 |
No.2056 非力なレッド
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-09-02 21:48:33 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 2,802 bytes |
| コンパイル時間 | 19,415 ms |
| コンパイル使用メモリ | 388,296 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-16 03:03:05 |
| 合計ジャッジ時間 | 17,691 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
// -*- coding:utf-8-unix -*-
#[allow(unused_imports)]
use std::io::{BufReader, BufWriter, Write, stdin, stdout, stderr};
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
($($r:tt)*) => {
let stdin = std::io::stdin();
let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
let mut next = move || -> String{
bytes.by_ref().map(|r|r.unwrap() as char)
.skip_while(|c|c.is_whitespace())
.take_while(|c|!c.is_whitespace())
.collect()
};
input_inner!{next, $($r)*}
};
}
macro_rules! input_inner {
($next:expr) => {};
($next:expr,) => {};
($next:expr, $var:ident : $t:tt $($r:tt)*) => {
let $var = read_value!($next, $t);
input_inner!{$next $($r)*}
};
}
macro_rules! read_value {
($next:expr, ( $($t:tt),* )) => { ($(read_value!($next, $t)),*) };
($next:expr, [ $t:tt ; $len:expr ]) => {
(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
};
($next:expr, chars) => {
read_value!($next, String).chars().collect::<Vec<char>>()
};
($next:expr, usize1) => (read_value!($next, usize) - 1);
($next:expr, [ $t:tt ]) => {{
let len = read_value!($next, usize);
read_value!($next, [$t; len])
}};
($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}
trait Change { fn chmax(&mut self, x: Self); fn chmin(&mut self, x: Self); }
impl<T: PartialOrd> Change for T {
fn chmax(&mut self, x: T) { if *self < x { *self = x; } }
fn chmin(&mut self, x: T) { if *self > x { *self = x; } }
}
fn main() {
let out = std::io::stdout();
let mut out = BufWriter::new(out.lock());
macro_rules! puts {($($format:tt)*) => (let _ = write!(out,$($format)*););}
let err = std::io::stderr();
#[allow(unused)]
let mut err = BufWriter::new(err.lock());
#[allow(unused)]
macro_rules! eputs {($($format:tt)*) => (let _ = write!(err,$($format)*););}
input! {
n: usize, x: u64, m: usize,
a: [u64; n],
}
let mut a = a;
let mut m = m;
let mut f = true;
loop {
let mut arg = None;
for i in 0..n {
if a[i] >= x { arg = Some(i); }
}
match arg {
Some(i) => {
if i + 1 > m {
f = false;
break;
}
m -= i + 1;
for j in 0..=i {
a[j] >>= 1;
}
},
None => break,
}
}
puts!("{}\n", if f { "Yes" } else { "No" });
}