結果
| 問題 |
No.647 明太子
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-04 19:51:05 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 4,500 ms |
| コード長 | 1,258 bytes |
| コンパイル時間 | 12,512 ms |
| コンパイル使用メモリ | 393,468 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-03 07:40:49 |
| 合計ジャッジ時間 | 13,338 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
use std::io::*;
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 ab: Vec<(usize, usize)> = (0..n)
.map(|_| {
(
itr.next().unwrap().parse().unwrap(),
itr.next().unwrap().parse().unwrap(),
)
})
.collect();
let m: usize = itr.next().unwrap().parse().unwrap();
let xy: Vec<(usize, usize)> = (0..m)
.map(|_| {
(
itr.next().unwrap().parse().unwrap(),
itr.next().unwrap().parse().unwrap(),
)
})
.collect();
let mut ans: Vec<Vec<usize>> = vec![Vec::new(); 10010];
for i in 0..m {
// 何人に買われるか
let mut cnt = 0;
for j in 0..n {
if xy[i].0 <= ab[j].0 && xy[i].1 >= ab[j].1 {
cnt += 1;
}
}
ans[cnt].push(i + 1);
}
for i in (1..10005).rev() {
if ans[i].len() > 0 {
for j in 0..ans[i].len() {
println!("{}", ans[i][j]);
}
return;
}
}
println!("0");
}