Submission #49793082
Source Code Expand
use proconio::{input, marker::Chars};
fn rotate(s: &[Vec<char>]) -> Vec<Vec<char>> {
let n = s.len();
let mut t = vec![vec![' '; n]; n];
for i in 0..n {
for j in 0..n {
t[j][n - 1 - i] = s[i][j];
}
}
t
}
fn main() {
input! {
n: usize,
mut s: [Chars; n],
t: [Chars; n],
};
if s.iter()
.map(|s_i| s_i.iter().filter(|&&c| c == '#').count())
.sum::<usize>()
!= t.iter()
.map(|t_i| t_i.iter().filter(|&&c| c == '#').count())
.sum::<usize>()
{
println!("No");
return;
}
for _ in 0..4 {
let n2 = n as i64;
for oi in -n2..=n2 {
for oj in -n2..=n2 {
let mut ok = true;
'outer: for i in 0..n {
for j in 0..n {
if s[i][j] == '#'
&& (!(0..n2).contains(&(i as i64 + oi))
|| !(0..n2).contains(&(j as i64 + oj))
|| t[(i as i64 + oi) as usize][(j as i64 + oj) as usize] != '#')
{
ok = false;
break 'outer;
}
}
}
if ok {
println!("Yes");
return;
}
}
}
s = rotate(&s);
}
println!("No");
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Shapes |
| User | bouzuya |
| Language | Rust (rustc 1.70.0) |
| Score | 300 |
| Code Size | 1479 Byte |
| Status | AC |
| Exec Time | 845 ms |
| Memory | 2628 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
| All | hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| hand_01.txt | AC | 0 ms | 1932 KiB |
| hand_02.txt | AC | 0 ms | 2096 KiB |
| hand_03.txt | AC | 0 ms | 2104 KiB |
| hand_04.txt | AC | 0 ms | 1816 KiB |
| hand_05.txt | AC | 0 ms | 1956 KiB |
| hand_06.txt | AC | 1 ms | 2348 KiB |
| hand_07.txt | AC | 1 ms | 2516 KiB |
| random_01.txt | AC | 217 ms | 2280 KiB |
| random_02.txt | AC | 0 ms | 2100 KiB |
| random_03.txt | AC | 845 ms | 2232 KiB |
| random_04.txt | AC | 26 ms | 2208 KiB |
| random_05.txt | AC | 7 ms | 2628 KiB |
| random_06.txt | AC | 5 ms | 2504 KiB |
| random_07.txt | AC | 17 ms | 2500 KiB |
| random_08.txt | AC | 13 ms | 2512 KiB |
| random_09.txt | AC | 1 ms | 2404 KiB |
| sample_01.txt | AC | 0 ms | 1920 KiB |
| sample_02.txt | AC | 0 ms | 2104 KiB |
| sample_03.txt | AC | 0 ms | 1912 KiB |
| sample_04.txt | AC | 0 ms | 1884 KiB |