Submission

Status:

PP--------

Subtask/Task Score:

20/100

Score: 20

User: purihorharin

Problemset: ทางเชื่อม

Language: c

Time: 0.182 second

Submitted On: 2026-03-19 21:01:42

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#define modulo 1000000007

int main () {
    int n;
    char *buf = NULL;
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        int l;
        scanf("%d ", &l);
        buf = realloc(buf, l+1);
        memset(buf, 0, l+1);

        for (int _ = 0; _ < 2; _++){
            for (int j = 0; j < l; j++) {
                int t = getchar();
                if (t == '#') buf[j]++;
            }
            getchar();
        }
        uint64_t count = 2;
        for (int j = 0; j < l; j++) {
            if (!buf[j+1]) {
                count *= 2 - buf[j];
                count %= modulo;
            }
        }
        printf("%llu\n", count);
    }
}