Submission #71705

#TimeUsernameProblemLanguageResultExecution timeMemory
71705CODEFORCES_BLUE (#119)Cross on the Grid (FXCUP3_cross)C++98
57 / 100
1078 ms828 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; ll n, m, ans, dp[4][2]={1, 4, 1, 2, 1, 3, 1, 3}, temp[4]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int i, j, mod=1e9+7; cin>>n; for(i=2;i<n;i++) { temp[0]=(dp[0][1]+2*dp[1][1]%mod+dp[2][0])%mod; temp[1]=(dp[3][0]+dp[3][1])%mod; temp[2]=(dp[0][1]+2*dp[1][1]%mod)%mod; temp[3]=(dp[0][1]+dp[1][1]%mod+dp[2][0])%mod; for(j=0;j<4;j++) { dp[j][0]=dp[j][1]; dp[j][1]=temp[j]; } } cout<<dp[0][0]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...