Submission #1703581
Source Code Expand
#include <bits/stdc++.h> #define REP(i,a,b) for(int i=(a);i<(b);i++) #define RREP(i,a,b) for(int i=(a);i>=(b);i--) typedef long long ll; typedef long double ld; using namespace std; const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,0,-1,1,0,0}; const ld PI=abs(acos(-1)); int n,a,dp[15][2]={}; int main(){ cin >> n; dp[0][1]=1; REP(i,0,n){ cin >> a; if(a%2){ dp[i+1][0]=dp[i][0]*3+dp[i][1]*2; dp[i+1][1]=dp[i][1]; }else{ dp[i+1][0]=dp[i][0]*3+dp[i][1]*1; dp[i+1][1]=dp[i][1]*2; } } cout << dp[n][0] << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Similar Arrays |
User | ecasdqina |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 575 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_0.txt, subtask0_1.txt, subtask0_2.txt, subtask0_3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt, subtask0_3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | AC | 1 ms | 256 KB |
07.txt | AC | 1 ms | 256 KB |
subtask0_0.txt | AC | 1 ms | 256 KB |
subtask0_1.txt | AC | 1 ms | 256 KB |
subtask0_2.txt | AC | 1 ms | 256 KB |
subtask0_3.txt | AC | 1 ms | 256 KB |