結果

問題 No.647 明太子
ユーザー tonyu0tonyu0
提出日時 2020-04-04 19:49:48
言語 Rust
(1.77.0)
結果
RE  
実行時間 -
コード長 1,256 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 145,092 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 06:07:09
合計ジャッジ時間 1,617 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 1 ms
4,376 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 2 ms
4,384 KB
testcase_22 RE -
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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(); 1010];
    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..1005).rev() {
        if ans[i].len() > 0 {
            for j in 0..ans[i].len() {
                println!("{}", ans[i][j]);
            }
            return;
        }
    }
    println!("0");
}
0