Created
March 10, 2020 05:32
-
-
Save akiradeveloper/b308069dbe90340dd4c932df778177c9 to your computer and use it in GitHub Desktop.
ECR83-C
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
fn solve() { | |
let out = stdout(); | |
let mut out = BufWriter::new(out.lock()); | |
input!{ | |
new_stdin_parser = parser, | |
t: usize, | |
} | |
for _ in 0..t { | |
input!{ | |
parser = parser, | |
n: usize, k: i64, | |
a:[i64;n] | |
} | |
let mut p = vec![0;100]; | |
for i in 0..n { | |
let bits = into_digits(k, a[i]); | |
let m = bits.len(); | |
for j in 0..m { | |
p[j] += bits[j]; | |
} | |
} | |
let mut ok = true; | |
for i in 0..100 { | |
if p[i] > 1 { | |
ok = false; | |
break; | |
} | |
} | |
writeln!(out,"{}",if ok { "YES" } else {"NO"}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment