結果
| 問題 |
No.9 モンスターのレベル上げ
|
| ユーザー |
|
| 提出日時 | 2019-12-15 21:27:56 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 929 bytes |
| コンパイル時間 | 11,860 ms |
| コンパイル使用メモリ | 388,652 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-02 18:21:04 |
| 合計ジャッジ時間 | 14,579 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 14 |
ソースコード
use std::io::Read;
fn main() {
let mut s: String = String::new();
std::io::stdin().read_to_string(&mut s).ok();
let mut itr = s.trim().split_whitespace();
let n: usize = itr.next().unwrap().parse().unwrap();
let a: Vec<i32> = (0..n)
.map(|_| itr.next().unwrap().parse().unwrap())
.collect();
let b: Vec<i32> = (0..n)
.map(|_| itr.next().unwrap().parse().unwrap())
.collect();
let mut ans: i32 = 0;
for i in 0..n {
let mut pq = std::collections::BinaryHeap::new();
for j in 0..n {
pq.push((-a[j], 0))
}
for j in 0..n {
let (mut level, mut count) = pq.pop().unwrap();
level *= -1;
count *= -1;
level += b[(i + j) % n] / 2;
count += 1;
ans = std::cmp::max(ans, count);
pq.push((-level, -count));
}
}
println!("{}", ans);
}