Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define sz(x) ((int) (x).size())
- #define sortc(x) sort((x).begin(), (x).end())
- #define forn(i, n) for (int i = 0; i < n; ++i)
- #define pb push_back
- #define mp make_pair
- #define int long long
- using namespace std;
- template <class c> auto try_out(c x) -> decltype(cerr << x, 0);
- char try_out(...);
- template <class c> struct range { c b, e; };
- template <class c> range<c> mrange(c i, c j) { return range<c>{i, j}; }
- struct err {
- template <class c, class d> err& operator << (pair<c,d> x) {
- return *this << "(" << x.first << ", " << x.second << ")";
- }
- template <class c> typename enable_if<sizeof(try_out(declval<c>())) != 1, err&>::type operator << (c x) {
- cerr << boolalpha << x;
- return *this;
- }
- template <class c> typename enable_if<sizeof(try_out(declval<c>())) == 1, err&>::type operator << (c x) {
- return *this << mrange(begin(x), end(x));
- }
- template <class c> err& operator << (range<c> x) {
- *this << "{";
- for (auto it = x.b; it != x.e; it++)
- *this << ", " + 2 * (it == x.b) << *it;
- return *this << "}";
- }
- };
- #define aty(...) "[ " << #__VA_ARGS__ << " : " << __VA_ARGS__ << " ]"
- int32_t main() {
- ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- int n, k;
- cin >> n >> k;
- vector<char> a(n + 1, 'L');
- a[0] = 'L';
- a[1] = 'W';
- a[2] = 'W';
- for (int i = 3; i < n + 1; ++i) {
- if (i >= k) {
- if (a[i - k] == 'L') {
- a[i] = 'W';
- }
- }
- if (a[i - 1] == 'L') {
- a[i] = 'W';
- }
- if (a[i - 2] == 'L') {
- a[i] = 'W';
- }
- }
- forn(i, n + 1) {
- cout << i << " : " << a[i] << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment