SHARE
TWEET

gen

Morass Sep 20th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define PB push_back
  4. #define ZERO (1e-10)
  5. #define INF int(1e9+1)
  6. #define CL(A,I) (memset(A,I,sizeof(A)))
  7. #define DEB printf("DEB!\n");
  8. #define D(X) cout<<"  "<<#X": "<<X<<endl;
  9. #define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
  10. typedef long long ll;
  11. typedef pair<ll,ll> pll;
  12. typedef vector<int> vi;
  13. typedef pair<int,int> ii;
  14. typedef vector<ii> vii;
  15. #define IN(n) int n;scanf("%d",&n);
  16. #define FOR(i, m, n) for (int i(m); i < n; i++)
  17. #define F(n) FOR(i,0,n)
  18. #define FF(n) FOR(j,0,n)
  19. #define FT(m, n) FOR(k, m, n)
  20. #define aa first
  21. #define bb second
  22. void ga(int N,int *A){F(N)scanf("%d",A+i);}
  23. #define MX 10
  24. int dp[MX][MX][MX][MX];
  25. int dyn(int a,int b,int c,int M){
  26.     if(!c)return 0;
  27.     int&v=dp[a][b][c][M];
  28.     if(~v)return v;
  29.     v=0;
  30.     FT(1,M+1)if(a>=k)v|=!dyn(a-k,b,c,M);
  31.     FT(1,M+1)if(b>k||(b==k&&!a))v|=!dyn(a,b-k,c,M);
  32.     FT(1,M+1)if(c>k||(c==k&&!b))v|=!dyn(a,b,c-k,M);
  33.     return v;
  34. }
  35. int main(void){
  36.     CL(dp,-1);
  37.     F(MX)FF(MX)FT(0,MX)FOR(l,0,MX)printf("[%d][%d][%d][%d]: %d\n",i,j,k,l,dyn(i,j,k,l));
  38.     return 0;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top