結果
問題 | No.1210 XOR Grid |
ユーザー |
|
提出日時 | 2020-08-30 16:09:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 361 ms / 2,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 82,152 KB |
実行使用メモリ | 267,916 KB |
最終ジャッジ日時 | 2024-11-15 10:49:36 |
合計ジャッジ時間 | 9,762 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 57 |
ソースコード
import sysinput = lambda : sys.stdin.readline().rstrip()sys.setrecursionlimit(max(1000, 10**9))write = lambda x: sys.stdout.write(x+"\n")n,m,x = list(map(int, input().split()))a = list(map(int, input().split()))b = list(map(int, input().split()))M = 10**9+7def sub(a,b):xa = 0xb = 0for num in a:xa ^= numfor num in b:xb ^= numif xa!=xb:return 0else:return pow(2,len(a)*len(b)-(len(a)+len(b))+1,M)ans = 1for i in range(x):res = sub([(item>>i)&1 for item in a], [(item>>i)&1 for item in b])if res == 0:ans = 0breakelse:ans *= resans %= Mprint(ans)