Skip to content

Commit 3aed71c

Browse files
committed
add abc398c.rs
1 parent 24e17a1 commit 3aed71c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/abc/abc398c.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/** THIS IS AN OUTPUT FILE. NOT EDIT THIS FILE DIRECTLY. **/
2+
use proconio::input;
3+
use proconio::marker::*;
4+
use std::marker::PhantomData;
5+
use std::cmp::*;
6+
use std::collections::*;
7+
8+
fn main() {
9+
input! {
10+
n:usize,
11+
a:[isize;n]
12+
}
13+
14+
let mut map = HashMap::new();
15+
for i in 0..n {
16+
*map.entry(a[i]).or_insert(0) += 1;
17+
}
18+
19+
let mut max = -1;
20+
for (k, v) in map {
21+
if v == 1 {
22+
max = max.max(k);
23+
}
24+
}
25+
26+
for i in 0..n {
27+
if a[i] == max {
28+
println!("{}", i + 1);
29+
return
30+
}
31+
}
32+
println!("{max}");
33+
}

0 commit comments

Comments
 (0)