Submission #59371801


Source Code Expand

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

use proconio::input;

pub fn main() {
    input! {
        n: usize,
        an: [i64; n]
    }
    let mut b: Vec<String> = vec![];
    let mut map: HashMap<i64, String> = HashMap::new();
    for i in 0..n {
        if let Some(v) = map.get_mut(&an[i]) {
            b.push(v.clone());
            *v = (i + 1).to_string();
        } else {
            b.push((-1).to_string());
            map.insert(an[i], (i + 1).to_string());
        }
    }
    println!("{}", b.join(" "));
}

Submission Info

Submission Time
Task C - Repeating
User macaroon
Language Rust (rustc 1.70.0)
Score 300
Code Size 546 Byte
Status AC
Exec Time 48 ms
Memory 31452 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 300 / 300
Status
AC × 2
AC × 28
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.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, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 1804 KiB
00_sample_02.txt AC 1 ms 1980 KiB
01_random_01.txt AC 23 ms 17652 KiB
01_random_02.txt AC 23 ms 17620 KiB
01_random_03.txt AC 23 ms 17612 KiB
01_random_04.txt AC 23 ms 17632 KiB
01_random_05.txt AC 23 ms 17632 KiB
01_random_06.txt AC 23 ms 17644 KiB
01_random_07.txt AC 23 ms 17636 KiB
01_random_08.txt AC 23 ms 17540 KiB
01_random_09.txt AC 23 ms 17556 KiB
01_random_10.txt AC 23 ms 17592 KiB
01_random_11.txt AC 7 ms 6188 KiB
01_random_12.txt AC 23 ms 17624 KiB
01_random_13.txt AC 16 ms 12888 KiB
01_random_14.txt AC 24 ms 17636 KiB
01_random_15.txt AC 9 ms 7648 KiB
01_random_16.txt AC 32 ms 20852 KiB
01_random_17.txt AC 19 ms 14124 KiB
01_random_18.txt AC 33 ms 20876 KiB
01_random_19.txt AC 3 ms 3476 KiB
01_random_20.txt AC 33 ms 20844 KiB
02_handmade_01.txt AC 1 ms 1852 KiB
02_handmade_02.txt AC 23 ms 17696 KiB
02_handmade_03.txt AC 48 ms 31356 KiB
02_handmade_04.txt AC 48 ms 31452 KiB
02_handmade_05.txt AC 47 ms 31408 KiB
02_handmade_06.txt AC 47 ms 31384 KiB