Skip to content

Commit f672c26

Browse files
committed
atcoder/abc055 (feedback from editorial)
1 parent f6a31a2 commit f672c26

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

atcoder/abc055/D/main.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ using ll = long long;
66
int N;
77
string S;
88

9-
bool solve(vector<char>& ws, char c0, char c1, char c2) {
10-
ws[0] = c1, ws[1] = c2, ws[N-1] = c0;
9+
bool solve(vector<char>& ws, char c0, char c1) {
10+
ws[0] = c0, ws[1] = c1;
1111
for (int i = 1; i < N; ++i) {
1212
int j = (i - 1 + N) % N, k = (i + 1) % N;
1313
if (S[i] == 'o') {
@@ -36,14 +36,10 @@ bool solve(vector<char>& ws, char c0, char c1, char c2) {
3636

3737
vector<char> solve() {
3838
vector<char> ws(N, ' ');
39-
if (solve(ws, 'W', 'S', 'W')) return ws;
40-
if (solve(ws, 'S', 'S', 'S')) return ws;
41-
if (solve(ws, 'W', 'W', 'S')) return ws;
42-
if (solve(ws, 'S', 'W', 'W')) return ws;
43-
if (solve(ws, 'W', 'S', 'S')) return ws;
44-
if (solve(ws, 'S', 'S', 'W')) return ws;
45-
if (solve(ws, 'S', 'W', 'S')) return ws;
46-
if (solve(ws, 'W', 'W', 'W')) return ws;
39+
if (solve(ws, 'S', 'S')) return ws;
40+
if (solve(ws, 'S', 'W')) return ws;
41+
if (solve(ws, 'W', 'S')) return ws;
42+
if (solve(ws, 'W', 'W')) return ws;
4743
return {};
4844
}
4945

0 commit comments

Comments
 (0)