Guest User

Untitled

a guest
Jul 14th, 2019
501
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. #define sz(x) ((int) (x).size())
  3. #define sortc(x) sort((x).begin(), (x).end())
  4. #define forn(i, n) for (int i = 0; i < n; ++i)
  5. #define pb push_back
  6. #define mp make_pair
  7. #define int long long
  8. using namespace std;
  9. template <class c> auto try_out(c x) -> decltype(cerr << x, 0);
  10. char try_out(...);
  11. template <class c> struct range { c b, e; };
  12. template <class c> range<c> mrange(c i, c j) { return range<c>{i, j}; }
  13. struct err {
  14. template <class c, class d> err& operator << (pair<c,d> x) {
  15. return *this << "(" << x.first << ", " << x.second << ")";
  16. }
  17. template <class c> typename enable_if<sizeof(try_out(declval<c>())) != 1, err&>::type operator << (c x) {
  18. cerr << boolalpha << x;
  19. return *this;
  20. }
  21. template <class c> typename enable_if<sizeof(try_out(declval<c>())) == 1, err&>::type operator << (c x) {
  22. return *this << mrange(begin(x), end(x));
  23. }
  24. template <class c> err& operator << (range<c> x) {
  25. *this << "{";
  26. for (auto it = x.b; it != x.e; it++)
  27. *this << ", " + 2 * (it == x.b) << *it;
  28. return *this << "}";
  29. }
  30. };
  31. #define aty(...) "[ " << #__VA_ARGS__ << " : " << __VA_ARGS__ << " ]"
  32.  
  33.  
  34.  
  35. int32_t main() {
  36. ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  37. int n, k;
  38. cin >> n >> k;
  39. vector<char> a(n + 1, 'L');
  40. a[0] = 'L';
  41. a[1] = 'W';
  42. a[2] = 'W';
  43. for (int i = 3; i < n + 1; ++i) {
  44. if (i >= k) {
  45. if (a[i - k] == 'L') {
  46. a[i] = 'W';
  47. }
  48. }
  49. if (a[i - 1] == 'L') {
  50. a[i] = 'W';
  51. }
  52. if (a[i - 2] == 'L') {
  53. a[i] = 'W';
  54. }
  55. }
  56. forn(i, n + 1) {
  57. cout << i << " : " << a[i] << "\n";
  58. }
  59. return 0;
  60. }
RAW Paste Data