Submission #59584275


Source Code Expand

use std::{clone, collections::HashMap};

use proconio::input;

pub fn main() {
    input! {
        n: usize,
        m: usize,
        xm: [usize; m],
        am: [usize; m],
    }
    let mut acc = 0;
    let mut ans = 0;
    let mut map = HashMap::new();
    for i in 0..m {
        map.insert(xm[i], am[i]);
    }
    for i in 0..n {
        acc += map.get(&(i + 1)).unwrap_or(&0);
        if acc == 0 {
            println!("{}", -1);
            return;
        }
        ans += acc - 1;
        acc -= 1;
    }
    println!("{}", ans);
}

Submission Info

Submission Time
Task C - Sowing Stones
User macaroon
Language Rust (rustc 1.70.0)
Score 0
Code Size 573 Byte
Status TLE
Exec Time 2211 ms
Memory 15204 KiB

Compile Error

warning: unused import: `clone`
 --> src/main.rs:1:11
  |
1 | use std::{clone, collections::HashMap};
  |           ^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 25
TLE × 18
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 02_hand_00.txt, 02_hand_01.txt, 02_hand_02.txt, 02_hand_03.txt, 02_hand_04.txt, 02_hand_05.txt, 02_hand_06.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 1928 KiB
00_sample_01.txt AC 1 ms 1872 KiB
01_random_00.txt AC 13 ms 11660 KiB
01_random_01.txt AC 21 ms 11792 KiB
01_random_02.txt AC 28 ms 13040 KiB
01_random_03.txt AC 22 ms 11732 KiB
01_random_04.txt AC 13 ms 11476 KiB
01_random_05.txt AC 14 ms 12132 KiB
01_random_06.txt AC 27 ms 12732 KiB
01_random_07.txt AC 21 ms 12224 KiB
01_random_08.txt AC 18 ms 13384 KiB
01_random_09.txt AC 19 ms 13860 KiB
01_random_10.txt TLE 2211 ms 7712 KiB
01_random_11.txt TLE 2208 ms 11788 KiB
01_random_12.txt AC 10 ms 7036 KiB
01_random_13.txt AC 8 ms 7308 KiB
01_random_14.txt AC 12 ms 7276 KiB
01_random_15.txt AC 9 ms 7932 KiB
01_random_16.txt AC 22 ms 15204 KiB
01_random_17.txt AC 17 ms 13284 KiB
01_random_18.txt AC 6 ms 5336 KiB
01_random_19.txt AC 12 ms 8800 KiB
01_random_20.txt TLE 2208 ms 14020 KiB
01_random_21.txt TLE 2208 ms 14076 KiB
01_random_22.txt TLE 2208 ms 13988 KiB
01_random_23.txt TLE 2208 ms 13904 KiB
01_random_24.txt TLE 2208 ms 14008 KiB
01_random_25.txt TLE 2208 ms 13952 KiB
01_random_26.txt TLE 2208 ms 14000 KiB
01_random_27.txt TLE 2208 ms 13956 KiB
01_random_28.txt TLE 2207 ms 1780 KiB
01_random_29.txt TLE 2210 ms 1932 KiB
01_random_30.txt TLE 2207 ms 1836 KiB
01_random_31.txt TLE 2207 ms 1924 KiB
01_random_32.txt TLE 2207 ms 1904 KiB
01_random_33.txt TLE 2207 ms 1988 KiB
02_hand_00.txt AC 20 ms 14864 KiB
02_hand_01.txt AC 16 ms 12812 KiB
02_hand_02.txt AC 10 ms 7556 KiB
02_hand_03.txt AC 8 ms 6680 KiB
02_hand_04.txt TLE 2207 ms 1876 KiB
02_hand_05.txt AC 1 ms 1904 KiB
02_hand_06.txt TLE 2208 ms 14032 KiB