Submission #2864209
Source Code Expand
#include<cstdio> #include<vector> #include<cstring> #include<iostream> #include<algorithm> #define mod 1000000007 using namespace std; char c[3][100]; int n,f[110]; long long ans; int main() { scanf("%d\n",&n); for(int i=1;i<=n;i++) { scanf("%c",&c[1][i]); } scanf("\n"); for(int i=1;i<=n;i++) { scanf("%c",&c[2][i]); } int cnt=0; for(int i=1;i<=n;i++) { if(c[1][i]==c[1][i+1]) { f[++cnt]=2; i++; } else { f[++cnt]=1; } } if(f[1]==2) ans=6; else ans=3; for(int i=1;i<cnt;i++) { if(f[i]==1) { if(f[i+1]==1) { ans=ans*2%mod; } if(f[i+1]==2) { ans=ans*2%mod; } } else { if(f[i+1]==1) { ans=ans%mod; } else { ans=ans*3%mod; } } } printf("%lld\n",ans); }
Submission Info
Submission Time | |
---|---|
Task | D - Coloring Dominoes |
User | vjudge5 |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 758 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:15:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d\n",&n); ^ ./Main.cpp:18:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%c",&c[1][i]); ^ ./Main.cpp:20:13: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("\n"); ^ ./Main.cpp:23:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%c",&c[2][i]); ^
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 |