Submission #3605568
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false), cin.tie(0) #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = a; i < b; i++) #define ALL(x) (x).begin(), (x).end() #define dump(x) cout << (x) << endl #define LMAX 9223372036854775807LL #define LMIN -9223372036854775807LL using ll = long long; template<typename T> using vec = vector<T>; using P = pair<ll, ll>; template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T *)array, (T *)(array + N), val); } const ll INF = 1e16; const ll MOD = 1e9 + 7; //int dx[4] = {1,0,-1,0}; //int dy[4] = {0,1,0,-1}; //ll pas[51][52]; signed main(){ IOS; int n; cin >> n; vec<string> s(2); cin >> s[0] >> s[1]; ll ans = 1; for(int i = 0;i < n;i++){ if(s[0][i] == s[1][i]){ if(i == 0){ ans = 3; } else{ if(s[0][i - 1] == s[1][i - 1])ans *= 2; ans %= MOD; } } else{ if(i == 0){ ans = 6; } else { if(s[0][i - 1] == s[1][i - 1])ans *= 2; else ans *= 3; ans %= MOD; } i++; } } dump(ans); }
Submission Info
Submission Time | |
---|---|
Task | D - Coloring Dominoes |
User | jgvt5ti |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1213 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
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 |