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
3 changed files
with
69 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
use proconio::{input, marker::Usize1}; | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
}; | ||
let ans = n - a.len(); | ||
println!("{}", ans); | ||
println!("{}", n); | ||
for i in 0..n { | ||
println!("{} {}", i + 1, (i + 1) % n + 1); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,24 @@ | ||
use proconio::{input, marker::Usize1}; | ||
use proconio::input; | ||
use superslice::Ext; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
mut c: [usize; n], | ||
q: usize, | ||
x: [usize; q], | ||
}; | ||
let ans = n - a.len(); | ||
println!("{}", ans); | ||
|
||
c.sort(); | ||
let cs = std::iter::once(0) | ||
.chain(c.iter().scan(0, |acc, &i| { | ||
*acc += i; | ||
Some(*acc) | ||
})) | ||
.collect::<Vec<usize>>(); | ||
|
||
for x_j in x { | ||
let count = cs.lower_bound(&(x_j + 1)).saturating_sub(1); | ||
println!("{}", count); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,52 @@ | ||
use proconio::{input, marker::Usize1}; | ||
use proconio::{input, marker::Chars}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
a: [Usize1; n], | ||
st: [(Chars, usize); n], | ||
}; | ||
let ans = n - a.len(); | ||
println!("{}", ans); | ||
|
||
let mut ans = vec![]; | ||
for x in 0..=9999 { | ||
let x = format!("{:04}", x).chars().collect::<Vec<char>>(); | ||
|
||
let mut ok = true; | ||
for (s, t) in st.iter() { | ||
let count = x | ||
.iter() | ||
.copied() | ||
.zip(s.iter().copied()) | ||
.filter(|(x_i, s_i)| x_i == s_i) | ||
.count(); | ||
match t { | ||
1 => { | ||
if count != 4 { | ||
ok = false; | ||
} | ||
} | ||
2 => { | ||
if count != 3 { | ||
ok = false; | ||
} | ||
} | ||
3 => { | ||
if count >= 3 { | ||
ok = false; | ||
} | ||
} | ||
_ => unreachable!(), | ||
} | ||
} | ||
|
||
if ok { | ||
ans.push(x); | ||
} | ||
} | ||
|
||
if ans.len() != 1 { | ||
println!("Can't Solve"); | ||
return; | ||
} | ||
|
||
println!("{}", ans[0].iter().collect::<String>()); | ||
} |