Tranvick

Untitled

Apr 3rd, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.46 KB | None | 0 0
  1. #pragma comment(linker, "/STACK:65777216")
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <cstdlib>
  5. #include <ctime>
  6. #include <cstdio>
  7. #include <algorithm>
  8. #include <cmath>
  9. #include <vector>
  10. #include <set>
  11. #include <stack>
  12. #include <map>
  13. #include <queue>
  14. #include <string>
  15. #include <memory.h>
  16. #include <iterator>
  17. #define y1 trololoy1
  18. #define y0 trololoy0
  19. #define mem(A,X) memset(A,X,sizeof(A))
  20. #define memo(A) memset(A,0,sizeof(A))
  21. #define forn(I,B) for (int I=1;I<=(B);I++)
  22. #define forg(H,V) for (int H=first[V];h;h=next[H])
  23. #define rep(I,B) for (int I=0;I<(B);I++)
  24. #define labs(X) (((X)>0)?(X):(-(X)))
  25. #define ropen(X) freopen(X,"r",stdin)
  26. #define wopen(X) freopen(X,"w",stdout)
  27. #define rwopen(X) freopen(X".in","r",stdin);freopen(X".out","w",stdout)
  28. #define pb push_back
  29. #define mp make_pair
  30. #define all(X) (X).begin(),(X).end()
  31. #define sqr(X) ((X)*(X))
  32.  
  33. using namespace std;
  34.  
  35. typedef pair <int,int> pii;
  36. typedef double ld;
  37. typedef long long ll;
  38. typedef pair <ll,ll> pll;
  39. typedef vector<int> vi;
  40. const int N=303;
  41. const int INF=111111111;
  42. const double eps=1e-9;
  43. const double pi=3.14159265358979;
  44.  
  45. map<vi,bool> win;
  46. int n,m;
  47.  
  48. inline bool calc(vi pos){
  49.     if (win.count(pos)) return win[pos];
  50.     rep(i,n) rep(x,pos[i]){
  51.         vi cur=pos;
  52.         for (int j=i;j<n;j++) cur[j]=x;
  53.         if (!calc(cur)){
  54.             win[pos]=1;
  55.             return 1;
  56.         }
  57.     }
  58.     win[pos]=0;
  59.     return 0;
  60. }
  61.        
  62. int main(){
  63.     for (n=1;n<=50;n++)
  64.         for (m=1;m<=50;m++){
  65.         vi beg(n,0);
  66.         win[beg]=1;
  67.         rep(i,n) beg[i]=m;
  68.         if (!calc(beg)) cout<<n<<" "<<m;
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment