Advertisement
Guest User

Untitled

a guest
Aug 26th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define e1 first
  4. #define e2 second
  5. #define pb push_back
  6. #define mp make_pair
  7. #define boost ios_base::sync_with_stdio(false)
  8. #define maxn 300100
  9. #define OUT(v) {cout << v; exit(0); }
  10. typedef long long int ll;
  11. typedef unsigned long long ull;
  12. typedef pair <int, int> PII;
  13. typedef pair <ll, ll> PLL;
  14. typedef pair <PII, PII> PP;
  15. typedef unsigned int ui;
  16. const int mod = 1e9+7;
  17. const int inf = 1e9+9;
  18. const ll MOD = 1e9+696969;
  19. const ll INF = 1e18+3;
  20. int cost[150];
  21.  
  22. int main()
  23. {
  24.     cost[1] = cost[0] = 0;
  25.     for (int i=2; i<=144; ++i)
  26.     {
  27.         int dp = inf;
  28.         int pol = (i / 2);
  29.         for (int j=1; j<=pol; ++j)
  30.         {
  31.             dp = min(dp, max(cost[j] + 2, cost[i - j] + 1));
  32.         }
  33.         cost[i] = dp;
  34.     }
  35.  
  36.     int ile;
  37.     scanf("%d", &ile);
  38.     if (ile < cost[144]) OUT("Not enough money");
  39.     puts("Let's play!");
  40.     vector <int> elems;
  41.     string s;
  42.     for (int i=1; i<=144; ++i) elems.push_back(i);
  43.     while (elems.size() > 1)
  44.     {
  45.         int i = elems.size();
  46.         vector <int> nowy;
  47.         nowy.clear();
  48.         int pol = (i / 2);
  49.         for (int j=1; j<=pol; ++j)
  50.           if (max(cost[j] + 2, cost[i - j]  + 1) == cost[i])
  51.           {
  52.             fflush(stdout);
  53.             printf("%d ", j);
  54.             for (int help = 0; help < j; ++help) printf("%d ", elems[help]);
  55.             printf("\n");
  56.             cin >> s;
  57.             if (s == "Yes") for (int help = 0; help < j; ++help) nowy.pb(elems[help]);
  58.             else for (int help = j; help < i; ++help) nowy.pb(elems[help]);
  59.             break;
  60.           }
  61.         elems.clear();
  62.         for (int j=0; j<nowy.size(); ++j) elems.push_back(nowy[j]);
  63.     }
  64.     cout << "0 "<< *elems.begin();
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement