-
Notifications
You must be signed in to change notification settings - Fork 0
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
442 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 = "abc322" | ||
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,29 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
s: String, | ||
}; | ||
if !s.contains("ABC") { | ||
println!("-1"); | ||
return; | ||
} | ||
let chars = s.chars().collect::<Vec<char>>(); | ||
for i in 0..n { | ||
if chars[i] != 'A' { | ||
continue; | ||
} | ||
let mut ok = true; | ||
for j in 0..3 { | ||
if chars[i + j] != ['A', 'B', 'C'][j] { | ||
ok = false; | ||
break; | ||
} | ||
} | ||
if ok { | ||
println!("{}", i + 1); | ||
return; | ||
} | ||
} | ||
} |
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,17 @@ | ||
use proconio::input; | ||
|
||
fn main() { | ||
input! { | ||
_n: usize, | ||
_m: usize, | ||
s: String, | ||
t: String, | ||
}; | ||
let ans = match (t.starts_with(&s), t.ends_with(&s)) { | ||
(true, true) => 0, | ||
(true, false) => 1, | ||
(false, true) => 2, | ||
(false, false) => 3, | ||
}; | ||
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,26 @@ | ||
use proconio::{input, marker::Usize1}; | ||
|
||
fn main() { | ||
input! { | ||
n: usize, | ||
m: usize, | ||
a: [Usize1; m], | ||
}; | ||
|
||
let mut ans = vec![n + 1; n]; | ||
for a_i in a { | ||
ans[a_i] = 0; | ||
} | ||
let mut count = 0_usize; | ||
for i in (0..n).rev() { | ||
if ans[i] == 0 { | ||
count = 0; | ||
} else { | ||
count += 1; | ||
ans[i] = count; | ||
} | ||
} | ||
for i in 0..n { | ||
println!("{}", ans[i]); | ||
} | ||
} |
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,98 @@ | ||
use proconio::{input, marker::Chars}; | ||
|
||
fn rotate(p: &[Vec<usize>]) -> Vec<Vec<usize>> { | ||
let mut v = vec![vec![0; 4]; 4]; | ||
for i in 0..4 { | ||
for j in 0..4 { | ||
v[j][4 - 1 - i] = p[i][j]; | ||
} | ||
} | ||
v | ||
} | ||
|
||
#[allow(dead_code)] | ||
fn print(p: &[Vec<usize>]) { | ||
for i in 0..4 { | ||
for j in 0..4 { | ||
print!("{}", p[i][j]); | ||
} | ||
println!(); | ||
} | ||
} | ||
|
||
fn f(p: &[Vec<Vec<usize>>], o: &[(i64, i64)]) -> bool { | ||
let mut board = vec![vec![0_usize; 4]; 4]; | ||
for k in 0..3 { | ||
for i in 0..4 { | ||
for j in 0..4 { | ||
if p[k][i][j] != 1 { | ||
continue; | ||
} | ||
if !(0..4).contains(&(o[k].0 + i as i64)) || !(0..4).contains(&(o[k].1 + j as i64)) | ||
{ | ||
return false; | ||
} | ||
let (bi, bj) = ((o[k].0 + i as i64) as usize, (o[k].1 + j as i64) as usize); | ||
board[bi][bj] += p[k][i][j]; | ||
if board[bi][bj] > 1 { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
|
||
for i in 0..4 { | ||
for j in 0..4 { | ||
if board[i][j] != 1 { | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
true | ||
} | ||
|
||
fn main() { | ||
input! { | ||
mut p: [[Chars; 4]; 3], | ||
}; | ||
let mut p = { | ||
let mut v = vec![vec![vec![0_usize; 4]; 4]; 4]; | ||
for k in 0..3 { | ||
for i in 0..4 { | ||
for j in 0..4 { | ||
v[k][i][j] = if p[k][i][j] == '#' { 1 } else { 0 }; | ||
} | ||
} | ||
} | ||
v | ||
}; | ||
|
||
let mut offsets = vec![]; | ||
for i in -3..=3 { | ||
for j in -3..=3 { | ||
offsets.push((i, j)); | ||
} | ||
} | ||
|
||
for _ in 0..4 { | ||
p[0] = rotate(&p[0]); | ||
for o0 in offsets.iter().copied() { | ||
for _ in 0..4 { | ||
p[1] = rotate(&p[1]); | ||
for o1 in offsets.iter().copied() { | ||
for _ in 0..4 { | ||
p[2] = rotate(&p[2]); | ||
for o2 in offsets.iter().copied() { | ||
if f(&p, &vec![o0, o1, o2]) { | ||
println!("Yes"); | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
println!("No"); | ||
} |
Oops, something went wrong.