Last active
July 8, 2021 02:45
-
-
Save tokugh/5839f7f23b198022729c6a979f8cf6a4 to your computer and use it in GitHub Desktop.
競プロ典型90問 ソースコード共有
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
// https://atcoder.jp/contests/typical90/submissions/24040491 | |
use proconio::{input, marker::Usize1}; | |
const MOD: i64 = 1_000_000_007; | |
fn main() { | |
input!{ | |
n: usize, | |
q: usize, | |
xyzw: [(Usize1, Usize1, Usize1, u64); q], | |
} | |
let mut ans: i64 = 1; | |
for i in 0..60 { | |
let mut cnt: i64 = 0; | |
for tmp in 0..1<<n { | |
let mut flag = true; | |
for &(x, y, z, w) in xyzw.iter() { | |
if w & 1<<i != 0 { | |
if (tmp & 1<<x == 0) && (tmp & 1<<y == 0) && (tmp & 1<<z == 0) { | |
flag = false; | |
} | |
} else { | |
if (tmp & 1<<x != 0) || (tmp & 1<<y != 0) || (tmp & 1<<z != 0) { | |
flag = false; | |
} | |
} | |
} | |
if flag { cnt += 1; } | |
} | |
ans = (ans * cnt) % MOD; | |
} | |
println!("{}", ans); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment