Advertisement
Guest User

Untitled

a guest
Oct 8th, 2021
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. #pragma GCC optimize("O3,unroll-loops")
  2. #pragma GCC target("avx2,fma,mmx,bmi2")
  3.  
  4. #include "bits/stdc++.h"
  5. using namespace std;
  6. #include <ext/pb_ds/assoc_container.hpp>
  7. #include <ext/pb_ds/tree_policy.hpp>
  8. using namespace __gnu_pbds;
  9. template<class key, class cmp = std::less<key>>
  10. using oset = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
  11.  
  12. void __print(int x) {cerr << x;}
  13. void __print(long long x) {cerr << x;}
  14. void __print(unsigned x) {cerr << x;}
  15. void __print(unsigned long long x) {cerr << x;}
  16. void __print(double x) {cerr << x;}
  17. void __print(long double x) {cerr << x;}
  18. void __print(char x) {cerr << '\'' << x << '\'';}
  19. void __print(const char *x) {cerr << '\"' << x << '\"';}
  20. void __print(const string &x) {cerr << '\"' << x << '\"';}
  21. void __print(bool x) {cerr << (x ? "true" : "false");}
  22. template<typename T, typename V>
  23. void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
  24. template<typename T>
  25. void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
  26. void _print() {cerr << "]\n";}
  27. template <typename T, typename... V>
  28. void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
  29. #ifndef ONLINE_JUDGE
  30. #define bug(x...) cerr << "[" << #x << "] = ["; _print(x)
  31. #else
  32. #define bug(x...)
  33. #endif
  34.  
  35. #define ll long long
  36. #define lld double
  37. #define all(x) x.begin(), x.end()
  38. #define iceil(n, x) (((n) + (x) - 1) / (x))
  39. #define gcd(a,b) __gcd(a,b)
  40. #define lcm(a,b) __detail::__lcm(a,b)
  41. #define goog(tno) cout << "Case #" << tno <<": "
  42.  
  43. ll dx[]= {-1,-1,-1,0,0,1,1,1};
  44. ll dy[]= {-1,0,1,-1,1,-1,0,1};
  45. const ll INF=2e18;
  46. const ll mod=1000000007;
  47. const ll maxn=1e5+5;
  48.  
  49. ll k;
  50. ll dp[65][10];
  51. bool vis[65][10];
  52.  
  53. // 1->white
  54. // 2->yellow
  55. // 3->green
  56. // 4->blue
  57. // 5->red
  58. // 6->orange
  59.  
  60. ll dfs(ll lvl,ll col){
  61. if(lvl==k) return 1;
  62. ll &ans=dp[lvl][col];
  63. if(vis[lvl][col]) return ans;
  64. vis[lvl][col]=1;
  65. ans=0;
  66. for(ll i=1;i<=6;i++){
  67. for(ll j=1;j<=6;j++){
  68. if(i==col||j==col) continue;
  69. if((i==2&&col==1)||(i==1&&col==2)||(j==1&&col==2)||(j==2&&col==1)) continue;
  70. if((i==3&&col==4)||(i==4&&col==3)||(j==3&&col==4)||(j==4&&col==3)) continue;
  71. if((i==5&&col==6)||(i==6&&col==5)||(j==5&&col==6)||(j==6&&col==5)) continue;
  72. ans=(ans+(dfs(lvl+1,i)*dfs(lvl+1,j))%mod)%mod;
  73. }
  74. }
  75. return ans;
  76. }
  77.  
  78. void solve(){
  79. cin>>k;
  80. ll ans=0;
  81. for(ll i=1;i<=6;i++){
  82. ans=(ans+dfs(1,i))%mod;
  83. }
  84. cout<<ans<<'\n';
  85. }
  86.  
  87. int main(){
  88. ios_base::sync_with_stdio(false), cin.tie(nullptr);
  89. //freopen("input.txt","r",stdin);
  90. //freopen("output.txt","w",stdout);
  91. ll t=1;
  92. // cin>>t;
  93. while(t--) solve();
  94. return 0;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement