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
11 changed files
with
366 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,14 @@ | ||
[package] | ||
name = "abc312" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
# dependencies added to new project | ||
[dependencies] | ||
num = "=0.2.1" | ||
proconio = { version = "=0.3.6", 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.42.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,11 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
s: String, | ||
}; | ||
let ans = vec!["ACE", "BDF", "CEG", "DFA", "EGB", "FAC", "GBD"] | ||
.iter() | ||
.any(|t| t == &s); | ||
println!("{}", if ans { "Yes" } else { "No" }); | ||
} |
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,71 @@ | ||
use proconio::{input, marker::Chars}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
m: usize, | ||
s: [Chars; n], | ||
}; | ||
let mut ans = vec![]; | ||
for i_tl in 0..n { | ||
'next: for j_tl in 0..m { | ||
if s[i_tl][j_tl] == '.' { | ||
continue; | ||
} | ||
if i_tl + 9 > n || j_tl + 9 > m { | ||
continue; | ||
} | ||
|
||
for i_offset in 0..3 { | ||
for j_offset in 0..3 { | ||
let (i, j) = (i_tl + i_offset, j_tl + j_offset); | ||
if s[i][j] == '.' { | ||
continue 'next; | ||
} | ||
} | ||
} | ||
for i_offset in 0..4 { | ||
let j_offset = 3; | ||
let (i, j) = (i_tl + i_offset, j_tl + j_offset); | ||
if s[i][j] == '#' { | ||
continue 'next; | ||
} | ||
} | ||
for j_offset in 0..4 { | ||
let i_offset = 3; | ||
let (i, j) = (i_tl + i_offset, j_tl + j_offset); | ||
if s[i][j] == '#' { | ||
continue 'next; | ||
} | ||
} | ||
|
||
for i_offset in 6..9 { | ||
let j_offset = 5; | ||
let (i, j) = (i_tl + i_offset, j_tl + j_offset); | ||
if s[i][j] == '#' { | ||
continue 'next; | ||
} | ||
} | ||
for j_offset in 6..9 { | ||
let i_offset = 5; | ||
let (i, j) = (i_tl + i_offset, j_tl + j_offset); | ||
if s[i][j] == '#' { | ||
continue 'next; | ||
} | ||
} | ||
for i_offset in 6..9 { | ||
for j_offset in 6..9 { | ||
let (i, j) = (i_tl + i_offset, j_tl + j_offset); | ||
if s[i][j] == '.' { | ||
continue 'next; | ||
} | ||
} | ||
} | ||
ans.push((i_tl, j_tl)); | ||
} | ||
} | ||
|
||
for (i, j) in ans { | ||
println!("{} {}", i + 1, j + 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
m: usize, | ||
a: [usize; n], | ||
b: [usize; m], | ||
}; | ||
let mut ok = 1_000_000_001_usize; | ||
let mut ng = 0_usize; | ||
while ok - ng > 1 { | ||
let mid = ng + (ok - ng) / 2; | ||
let c_a = a.iter().filter(|&a_i| *a_i <= mid).count(); | ||
let c_b = b.iter().filter(|&b_i| *b_i >= mid).count(); | ||
if c_a >= c_b { | ||
ok = mid; | ||
} else { | ||
ng = mid; | ||
} | ||
} | ||
let ans = ok; | ||
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,44 @@ | ||
use proconio::{input, marker::Chars}; | ||
|
||
fn main() { | ||
input! { | ||
s: Chars, | ||
}; | ||
let p = 998_244_353_usize; | ||
let mut dp = vec![0_usize; 3000 + 1]; | ||
dp[0] = 1_usize; | ||
for s_i in s.iter().copied() { | ||
let mut next = vec![0_usize; 3000 + 1]; | ||
for j in 0..=3000 { | ||
match s_i { | ||
'(' => { | ||
if j + 1 <= 3000 { | ||
next[j + 1] += dp[j]; | ||
next[j + 1] %= p; | ||
} | ||
} | ||
')' => { | ||
if j > 0 { | ||
next[j - 1] += dp[j]; | ||
next[j - 1] %= p; | ||
} | ||
} | ||
'?' => { | ||
if j + 1 <= 3000 { | ||
next[j + 1] += dp[j]; | ||
next[j + 1] %= p; | ||
} | ||
if j > 0 { | ||
next[j - 1] += dp[j]; | ||
next[j - 1] %= p; | ||
} | ||
} | ||
_ => unreachable!(), | ||
} | ||
} | ||
dp = next; | ||
} | ||
|
||
let ans = dp[0]; | ||
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); | ||
} |
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); | ||
} |