Skip to content

Commit 83086f3

Browse files
committed
add abc408c.rs
1 parent 105c35f commit 83086f3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/abc/abc408c.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
m:usize,
12+
lr:[(Usize1,Usize1);m]
13+
}
14+
15+
let mut memo = vec![(0,0);n];
16+
for (l,r) in lr {
17+
memo[l].0 += 1;
18+
memo[r].1 += 1;
19+
}
20+
21+
let mut result = n+1;
22+
let mut temp = 0;
23+
for (add,minus) in memo {
24+
temp += add;
25+
result = std::cmp::min(result, temp);
26+
temp -= minus;
27+
}
28+
29+
println!("{}", result);
30+
}

0 commit comments

Comments
 (0)