Submission #60322675


Source Code Expand

use proconio::{input, marker::Chars};

pub fn main() {
    input! {
        n: usize,
        m: usize,
        an: [usize; n],
        bm: [usize; m]
    };
    let mut adec = vec![];
    let mut index = vec![];
    let mut prev = 2 * 10usize.pow(5) + 1;
    for i in 0..n {
        if an[i] >= prev {
            continue;
        }
        adec.push(an[i]);
        prev = an[i];
        index.push(i);
    }
    adec.reverse();
    index.reverse();
    for i in 0..m {
        if let Ok(x) = adec.binary_search(&bm[i]) {
            println!("{}", index[x] + 1);
        } else {
            let x = adec.binary_search(&bm[i]).err().unwrap();
            if x == 0 {
                println!("{}", -1);
            } else {
                println!("{}", index[x - 1] + 1);
            }
        }
    }
}

Submission Info

Submission Time
Task C - Kaiten Sushi
User macaroon
Language Rust (rustc 1.70.0)
Score 350
Code Size 845 Byte
Status AC
Exec Time 240 ms
Memory 10824 KiB

Compile Error

warning: unused import: `marker::Chars`
 --> src/main.rs:1:23
  |
1 | use proconio::{input, marker::Chars};
  |                       ^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 3
AC × 30
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 02_random2_16.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 1996 KiB
00_sample_01.txt AC 1 ms 2144 KiB
00_sample_02.txt AC 1 ms 1920 KiB
01_random_00.txt AC 83 ms 3968 KiB
01_random_01.txt AC 34 ms 2952 KiB
01_random_02.txt AC 161 ms 5396 KiB
01_random_03.txt AC 156 ms 6788 KiB
01_random_04.txt AC 87 ms 4864 KiB
02_random2_00.txt AC 188 ms 7460 KiB
02_random2_01.txt AC 225 ms 7988 KiB
02_random2_02.txt AC 230 ms 7996 KiB
02_random2_03.txt AC 228 ms 8260 KiB
02_random2_04.txt AC 230 ms 8664 KiB
02_random2_05.txt AC 233 ms 8520 KiB
02_random2_06.txt AC 235 ms 8848 KiB
02_random2_07.txt AC 237 ms 9060 KiB
02_random2_08.txt AC 237 ms 9208 KiB
02_random2_09.txt AC 238 ms 9376 KiB
02_random2_10.txt AC 239 ms 9632 KiB
02_random2_11.txt AC 240 ms 9708 KiB
02_random2_12.txt AC 240 ms 10088 KiB
02_random2_13.txt AC 240 ms 10088 KiB
02_random2_14.txt AC 240 ms 10276 KiB
02_random2_15.txt AC 239 ms 10676 KiB
02_random2_16.txt AC 239 ms 10824 KiB
03_handmade_00.txt AC 197 ms 10816 KiB
03_handmade_01.txt AC 187 ms 7388 KiB
03_handmade_02.txt AC 181 ms 4528 KiB
03_handmade_03.txt AC 182 ms 4496 KiB
03_handmade_04.txt AC 1 ms 2084 KiB