fork download
  1.  
  2. // CoU-BRACNet Inter-University Programming Contest 2023
  3. // Problem A: A. Where is the Ghost
  4.  
  5.  
  6.  
  7.  
  8. #include<bits/stdc++.h>
  9. #include<math.h>
  10. #define ll long long int
  11. #define ull unsigned long long int
  12. #include <ext/pb_ds/detail/standard_policies.hpp>
  13. #include <ext/pb_ds/assoc_container.hpp>
  14. #include <ext/pb_ds/tree_policy.hpp>
  15. using namespace std;
  16. using namespace __gnu_pbds;
  17.  
  18. typedef tree< ll, null_type, less<ll >, rb_tree_tag, tree_order_statistics_node_update> order_set;
  19. #define fbo find_by_order
  20. #define ook order_of_key
  21. #define F first
  22. #define S second
  23. #define all(x) (x).begin(),(x).end()
  24. #define print(res) cout<<#res<<" = ";for(auto x:res) cout<<x<<" "; cout<<endl
  25. #define see(res) cout<<#res<<" = "<<res<<endl
  26. #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  27. #define pf push_front
  28. #define pb push_back
  29. #define NL printf("\n")
  30. #define YES printf("YES\n")
  31. #define NO printf("NO\n")
  32. #define Yes printf("Yes\n")
  33. #define No printf("No\n")
  34. #define tc int tc;scanf("%d",&tc);for(int cs=1;cs<=tc;cs++)
  35.  
  36. const ll N=1e6+6;
  37. const ll mxn=2e5+6;
  38. const ll mod=1e9+7;
  39.  
  40. ll ara[10011] , n ;
  41. ll dp[10011][2550];
  42.  
  43. ll Fun(ll ind , ll val)
  44. {
  45. if(ind>n)
  46. {
  47. return val==0 ? 1:0 ;
  48. }
  49. if(dp[ind][val]!=-1) return dp[ind][val] %mod ;
  50.  
  51. ll ans = 0 ;
  52.  
  53. ans+=(Fun(ind+1 , val )); ans%=mod;
  54. ans+=(Fun(ind+1 , (val*ara[ind])%2520) );ans%=mod;
  55. return dp[ind][val] = ans ;
  56. }
  57.  
  58. int main( )
  59. {
  60.  
  61. // tc
  62.  
  63. {
  64. memset(dp , -1 , sizeof(dp));
  65. cin>>n ;
  66. for(ll i=1 ; i<=n ; i++) cin>>ara[i] ;
  67. cout<<Fun(1,1)%mod<<endl;
  68. }
  69.  
  70. return 0;
  71. }
  72. //printf("Case %d: ",cs);
  73.  
Success #stdin #stdout 0.09s 203020KB
stdin
Standard input is empty
stdout
0