結果
| 問題 |
No.507 ゲーム大会(チーム決め)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-11 16:05:26 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,362 bytes |
| コンパイル時間 | 16,758 ms |
| コンパイル使用メモリ | 377,828 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-12 20:40:20 |
| 合計ジャッジ時間 | 33,449 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 TLE * 4 -- * 7 |
コンパイルメッセージ
warning: unused `Result` that must be used --> src/main.rs:6:9 | 6 | io::stdin().read_line(&mut s); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default help: use `let _ = ...` to ignore the resulting value | 6 | let _ = io::stdin().read_line(&mut s); | +++++++ warning: unused `Result` that must be used --> src/main.rs:13:9 | 13 | io::stdin().read_line(&mut s); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled help: use `let _ = ...` to ignore the resulting value | 13 | let _ = io::stdin().read_line(&mut s); | +++++++ warning: unused `Result` that must be used --> src/main.rs:19:13 | 19 | io::stdin().read_line(&mut s); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled help: use `let _ = ...` to ignore the resulting value | 19 | let _ = io::stdin().read_line(&mut s); | +++++++
ソースコード
use std::io;
fn main() {
let nm: Vec<u32> = {
let mut s = String::new();
io::stdin().read_line(&mut s);
s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect()
};
let n = nm[0];
let m = nm[1];
let k: u32 = {
let mut s = String::new();
io::stdin().read_line(&mut s);
s.trim().parse().unwrap()
};
let mut a: Vec<u32> = {
(1..n).into_iter().map(|_| {
let mut s = String::new();
io::stdin().read_line(&mut s);
s.trim().parse().unwrap()
}).collect()
};
a.sort();
for i in 0..a.len() {
let us = k + a[i];
let mut gt_us = 0;
let mut tail = a.len() - 1;
if tail == i {
tail -= 1;
}
for head in 0..a.len() {
if head == i {
continue;
}
if head >= tail {
break;
}
if a[head] + a[tail] > us {
gt_us += 1;
if gt_us >= m {
break;
}
tail -= 1;
if tail == i {
tail -= 1;
}
continue;
}
}
if gt_us < m {
println!("{}", a[i]);
return;
}
}
println!("-1");
}