Submission
Status:
Compilation Error
Subtask/Task Score:
Score: 0
User: prepremier
Problemset: ทางเชื่อม
Language: cpp
Time: 0.000 second
Submitted On: 2026-05-18 15:49:38
#include <bits/stdc++.h>
using namespace std;
#define premier_code ios::sync_with_stdio(0);cin.tie(0);
char arr[7][5005];
long long dp[7][5005];
const int M = 1e9+7;
int main(){
seng_code
int m;cin >> m;
while(m--){
int n;cin >> n;
int ans = 0;
memset(dp, sizeof(dp), 0);
for(int i = 1; i <= 2; i++){
for(int j = 1; j <= n; j++){
cin >> arr[i][j];
}
}
dp[1][0] = dp[2][0] = 1;
for(int j = 1; j <= n; j++){
if(arr[1][j] == '#' && arr[2][j] == '.'){
dp[1][j] = 0;
dp[2][j] = (dp[2][j-1]%M);
}
else if(arr[1][j] == '.' && arr[2][j] == '#'){
dp[1][j] = (dp[1][j-1]%M);
dp[2][j] = 0;
}
else if(arr[1][j] == '#' && arr[2][j] == '#'){
dp[1][j] = dp[2][j] = 0;
}
else{
dp[1][j] = dp[2][j] = (dp[1][j-1]+dp[2][j-1])%M;
}
}
cout << (dp[1][n]+dp[2][n])%M << '\n';
}
}