Submission #1964488


Source Code Expand

/*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int MOD=1e9+7;
int xy[2][2]={2,2,1,3};
char str1[55],str2[55];
int main ()
{
    int i,n;
    ll ans;
    bool type;
    scanf ("%d",&n);
    scanf ("%s%s",str1,str2);
    if (str1[0]==str2[0]) {
        type=0;
        ans=3;
        i=1;
    }
    else {
        type=1;
        ans=6;
        i=2;
    }
    while (i<n) {
        if (str1[i]==str2[i]) {
            ans=(ans*xy[type][0])%MOD;
            i+=1;
            type=0;
        }
        else {
            ans=(ans*xy[type][1])%MOD;
            i+=2;
            type=1;
        }
    }
    printf ("%lld\n",ans);

    return 0;
}

Submission Info

Submission Time
Task D - Coloring Dominoes
User Basilisk1995
Language C++14 (GCC 5.4.1)
Score 400
Code Size 788 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:15:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d",&n);
                    ^
./Main.cpp:16:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%s%s",str1,str2);
                             ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 28
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt AC 1 ms 256 KB
10.txt AC 1 ms 256 KB
11.txt AC 1 ms 256 KB
12.txt AC 1 ms 256 KB
13.txt AC 1 ms 256 KB
14.txt AC 1 ms 256 KB
15.txt AC 1 ms 256 KB
16.txt AC 1 ms 256 KB
17.txt AC 1 ms 256 KB
18.txt AC 1 ms 256 KB
19.txt AC 1 ms 256 KB
2.txt AC 1 ms 256 KB
20.txt AC 1 ms 256 KB
21.txt AC 1 ms 256 KB
22.txt AC 1 ms 256 KB
3.txt AC 1 ms 256 KB
4.txt AC 1 ms 256 KB
5.txt AC 1 ms 256 KB
6.txt AC 1 ms 256 KB
7.txt AC 1 ms 256 KB
8.txt AC 1 ms 256 KB
9.txt AC 1 ms 256 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB