結果
問題 | No.2911 位相の公理 |
ユーザー |
|
提出日時 | 2024-10-04 23:06:04 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 771 bytes |
コンパイル時間 | 12,552 ms |
コンパイル使用メモリ | 376,444 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 23:06:18 |
合計ジャッジ時間 | 12,866 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
use proconio::input;fn main() {println!("{}", if solve() { "Yes" } else { "No" });}fn solve() -> bool {input! {(n, m): (usize, usize),ss: [String; m],}if !ss.contains(&"0".repeat(n)) || !ss.contains(&"1".repeat(n)) {return false;}let set = ss.iter().map(|s| {s.chars().fold(0_usize, |acc, c| 2 * acc + (c == '1') as usize)}).collect::<Vec<_>>();let mut exists = vec![false; 1 << n];for &bits in &set {exists[bits] = true;}for &bits1 in &set {for &bits2 in &set {if !exists[bits1 & bits2] || !exists[bits1 | bits2] {return false;}}}true}