forked from gitter-badger/Interview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCF544B.cpp
More file actions
32 lines (31 loc) · 665 Bytes
/
CF544B.cpp
File metadata and controls
32 lines (31 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n, k;
scanf("%d %d", &n, &k);
vector<string> ans(n, "");
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
int op = (i + j) & 1;
if (op == 0 && k > 0) {
k -= 1;
ans[i] += "L";
} else {
ans[i] += "S";
}
}
}
if (k == 0) {
puts("YES");
for (int i = 0; i < n; i++)
puts(ans[i].c_str());
} else {
puts("NO");
}
return 0;
}