Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
331 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "abc331" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# dependencies added to new project | ||
[dependencies] | ||
ac-library-rs = "=0.1.1" | ||
num = "=0.4.0" | ||
proconio = { version = "=0.4.3", features = ["derive"] } | ||
superslice = "=1.0.0" | ||
|
||
[profile.release] | ||
lto = true | ||
panic = 'abort' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.70.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
capital_m: usize, | ||
capital_d: usize, | ||
y: usize, | ||
m: usize, | ||
d: usize, | ||
}; | ||
|
||
let nd = if d == capital_d { 1 } else { d + 1 }; | ||
let nm = if d == capital_d { | ||
if m == capital_m { | ||
1 | ||
} else { | ||
m + 1 | ||
} | ||
} else { | ||
m | ||
}; | ||
let ny = if d == capital_d && m == capital_m { | ||
y + 1 | ||
} else { | ||
y | ||
}; | ||
println!("{} {} {}", ny, nm, nd); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
s: usize, | ||
m: usize, | ||
l: usize, | ||
}; | ||
let mut min = 1_000_000_000; | ||
for a in 0..100 { | ||
for b in 0..100 { | ||
for c in 0..100 { | ||
if 6 * a + 8 * b + 12 * c >= n { | ||
min = min.min(s * a + m * b + l * c); | ||
} | ||
} | ||
} | ||
} | ||
let ans = min; | ||
println!("{}", ans); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use proconio::input; | ||
use superslice::Ext; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [usize; n], | ||
}; | ||
let mut b = a.clone(); | ||
b.sort(); | ||
let c = std::iter::once(0) | ||
.chain(b.iter().scan(0, |acc, &i| { | ||
*acc += i; | ||
Some(*acc) | ||
})) | ||
.collect::<Vec<usize>>(); | ||
for a_i in a.iter().copied() { | ||
let index = b.lower_bound(&(a_i + 1)); | ||
println!("{}", c[n] - c[index]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
}; | ||
let ans = n - a.len(); | ||
println!("{}", ans); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use std::collections::{HashMap, HashSet}; | ||
|
||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
m: usize, | ||
l: usize, | ||
a: [usize; n], | ||
b: [usize; m], | ||
cd: [(Usize1, Usize1); l], | ||
}; | ||
|
||
let mut bi = b | ||
.iter() | ||
.enumerate() | ||
.map(|(i, b_i)| (*b_i, i)) | ||
.collect::<Vec<(usize, usize)>>(); | ||
bi.sort_by_key(|(b_i, _)| *b_i); | ||
bi.reverse(); | ||
|
||
let mut sets = HashMap::new(); | ||
for (c, d) in cd { | ||
sets.entry(c).or_insert_with(HashSet::new).insert(d); | ||
} | ||
|
||
let mut max = 0_usize; | ||
for (i, a_i) in a.iter().enumerate() { | ||
match sets.get(&i) { | ||
Some(set) => { | ||
for (b_i, i) in bi.iter().copied() { | ||
if !set.contains(&i) { | ||
max = max.max(a_i + b_i); | ||
break; | ||
} | ||
} | ||
} | ||
None => max = max.max(a_i + bi[0].0), | ||
} | ||
} | ||
|
||
let ans = max; | ||
println!("{}", ans); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
}; | ||
let ans = n - a.len(); | ||
println!("{}", ans); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
}; | ||
let ans = n - a.len(); | ||
println!("{}", ans); | ||
} |