Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save akiradeveloper/b308069dbe90340dd4c932df778177c9 to your computer and use it in GitHub Desktop.
Save akiradeveloper/b308069dbe90340dd4c932df778177c9 to your computer and use it in GitHub Desktop.
ECR83-C
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