-
Notifications
You must be signed in to change notification settings - Fork 0
/
c.rs
39 lines (34 loc) · 811 Bytes
/
c.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::collections::HashSet;
use proconio::input;
fn main() {
input! {
a: [[usize; 9]; 9],
};
for i in 0..9 {
if (0..9).map(|j| a[i][j]).collect::<HashSet<usize>>().len() != 9 {
println!("No");
return;
}
}
for j in 0..9 {
if (0..9).map(|i| a[i][j]).collect::<HashSet<usize>>().len() != 9 {
println!("No");
return;
}
}
for bi in 0..3 {
for bj in 0..3 {
let mut b = HashSet::new();
for i in 0..3 {
for j in 0..3 {
b.insert(a[bi * 3 + i][bj * 3 + j]);
}
}
if b.len() != 9 {
println!("No");
return;
}
}
}
println!("Yes");
}