用户输出
1
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#49014 | #1260. 初学围棋 | Accepted | 100 | 115 ms | 472 K | C++ 11 / 4.1 K | feicheng | 2021-05-20 8:52:56 |
/*
If you are full of hope,you will be invincible.
Writer:feicheng
Problem Number:
*/
#include <cstdio>
#include <ctime>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <random>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/pb_ds/hash_policy.hpp>
std::mt19937 rnd(time(nullptr) + (unsigned long long)(new char)+20051107);
std::mt19937_64 Rnd(time(nullptr) + (unsigned long long)(new char)+20060923);
constexpr char endl = '\n';
namespace hpy {
constexpr int HL = 1 << 19;
char buf[HL], buff[HL], *t1 = buf, *t2 = buf, *T = buff;
#ifdef feicheng
#define getc() getchar()
#else
#define getc() (t1 == t2 && (t2 = (t1 = buf) + fread(buf, 1, HL, stdin), t1 == t2) ? EOF : *t1++)
#endif
inline void flush() { fwrite(buff, 1, T - buff, stdout), T = buff; }
inline void putc(const char ch) { T == buff + HL ? flush(), *T++ = ch : *T++ = ch; }
struct Read {
template <typename Tp>
inline Read &operator>>(Tp &x) {
char ch = getc();
int f = 0;
for (; ch < '0' || ch > '9'; ch = getc()) f = (ch == '-') ? 1 : 0;
x = 0;
for (; ch >= '0' && ch <= '9'; ch = getc()) x = (x << 3) + (x << 1) + (ch ^ 48);
return x = f ? -x : x, *this;
}
inline Read &operator>>(char &c) {
for (c = getc(); c == ' ' || c == '\n'; c = getc())
;
return *this;
}
inline Read &operator>>(char *str) {
int len = 0;
char ch = getc();
while (ch == ' ' || ch == '\n') ch = getc();
while (ch != ' ' && ch != '\n' && ch != '\r' && ch != EOF) str[len++] = ch, ch = getc();
return str[len] = '\0', *this;
}
} cin;
struct Write {
template <typename Tp>
inline Write &operator<<(Tp x) {
if (!x)
return putc('0'), *this;
if (x < 0)
putc('-'), x = -x;
int stk[19], top = 0;
while (x) stk[++top] = x % 10, x /= 10;
while (top) putc(stk[top--] + '0');
return *this;
}
inline Write &operator<<(const char ch) { return putc(ch), *this; }
inline Write &operator<<(char *str) {
int cur = 0;
while (str[cur]) putc(str[cur++]);
return *this;
}
inline Write &operator<<(const char *str) {
int cur = 0;
while (str[cur]) putc(str[cur++]);
return *this;
}
} cout;
template <typename Tp>
inline Tp max(const Tp &a, const Tp &b) {
return a > b ? a : b;
}
template <typename Tp, typename... Rst>
Tp max(const Tp &a, const Rst... rst) {
return max(a, max(rst...));
}
template <typename Tp>
inline Tp min(const Tp &a, const Tp &b) {
return a < b ? a : b;
}
template <typename Tp, typename... Rst>
Tp min(const Tp &a, const Rst... rst) {
return min(a, min(rst...));
}
} // namespace hpy
using hpy::cin;
using hpy::cout;
using hpy::max;
using hpy::min;
constexpr int N = 105;
int n, ans;
char s[N];
namespace hl {
inline int check() {
int res = 0;
for (int i = 1; i <= n; ++i) {
bool sign = 0;
for (int j = i + 2; j <= n; ++j) {
if (s[i] == 'W' && s[j] == 'W') {
sign = 1;
for (int k = i + 1; k < j; ++k) {
if (s[k] != 'B') {
sign = 0;
break;
}
}
if (sign)
res = max(res, j - i - 1);
}
if (s[i] == 'B' && s[j] == 'B') {
sign = 1;
for (int k = i + 1; k < j; ++k) {
if (s[k] != 'W') {
sign = 0;
break;
}
}
if (sign)
return 0;
}
}
}
return res;
}
inline void fc() {
cin >> n >> (s + 1);
for (int i = 1; i <= n; ++i) {
if (s[i] != '.')
continue;
s[i] = 'W', ans = max(ans, check()), s[i] = '.';
}
cout << ans;
}
} // namespace hl
int main(int argc, const char **argv) {
#ifdef feicheng
freopen("wild.in", "r", stdin);
freopen("wild.out", "w", stdout);
#endif
hl::fc();
#ifdef feicheng
std::cout << "your program costs " << (double)clock() / CLOCKS_PER_SEC << " s" << std::endl;
#endif
return hpy::flush(), 0;
}
100 BBBBBBBBBBBBBB.WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
83
系统信息
Exited with return code 0
100 B.WBBBBBBBBBBBBBB.WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
80
系统信息
Exited with return code 0
100 BBBBBBB.WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.W.WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.WBBBB
<5 bytes omitted>
用户输出
41
系统信息
Exited with return code 0
100 BBBBBBBBBBBBBBBBBB.W.WBBBBBBBBBBB.WBBBBBBBBBBBBBBBB.WBBBBBBBB.WBBBBBBBBBBBBBBBBBBBBBB.W.WBBBBBBB
<5 bytes omitted>
用户输出
22
系统信息
Exited with return code 0
100 .W.WBBBBBBBBB.W.W.WBBBBBB.WBBB.WBBBBBBB.WBB.WBB.WBBBBBBBBBBBBB.WBBBBBB.WBBBBBBBBBBBBBBBBBBBBB..W
<5 bytes omitted>
用户输出
21
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBW.BBB
<5 bytes omitted>
用户输出
90
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBW.BBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
72
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBBBW.BBBBBBBW.BBBBBBBBBBBBBBW.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBW.BBBBBBBBBBB
<5 bytes omitted>
用户输出
20
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBW.BBBBBBBBBBBW.BW.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBW.BBBBBW.BBBBBBW.BBBBBBBBBBW.B
<5 bytes omitted>
用户输出
13
系统信息
Exited with return code 0
100 .BBW.BBBBBBBBW.BBBBBBBBBBBW.W.BBBBW.BBBBBBBBWW..BBBBW.BBBBBBW.BBBBBBBBW.BBBBW.BBBBBW.BBW.W.BBBBB
<5 bytes omitted>
用户输出
4
系统信息
Exited with return code 0
用户输出
38
系统信息
Exited with return code 0
用户输出
58
系统信息
Exited with return code 0
用户输出
78
系统信息
Exited with return code 0
100 WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
98
系统信息
Exited with return code 0
用户输出
38
系统信息
Exited with return code 0
用户输出
58
系统信息
Exited with return code 0
用户输出
78
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
98
系统信息
Exited with return code 0
100 WBBBBBBBBBBBBBBBBBB..BB.BBBBBBBBBBB..BBBBBBBBBBBBBBB.BBBBBBBBBBBB.BBBBBBB.BBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 BBBBBB.B.BBBB.BBB.B.WBBBBBBBBBBBBBBBBBB..BBBB.BBBBBBBBBBBBB.BB..BBBBBB..B.BBBBBBBB.....BBBBBBBBB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 BBB.BBBBBBBBBBB.BBBBBBBBBBBBBBBBBBBB.BB.WBBBBBBBBBBBBBBBBBB...BBBBB..BBBB.BBBBBBBB.BBBBBB.BBB.BB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 .BBBB..B.BB.BBBBBBB.B.BB.BBBBBBBB.B.BB.B..B.BB.BBBBBBBBBBBB.WBBBBBBBBBBBBBBBBBB..BBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 .B.B.BBBBBBBBBBBBBBBBBB.BBBBBBBBB.BBBBBBBB.BBBBBBB..BBBBBBBB.BBB.BBB.BBB.BBBBBB.WBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 .BBBB.B..BB.B.BBBBBBBB.BB.BBBBBB..BBB.B.BBBB.B.BBBB.BBB.BB.BBBBB.BBBBBBBBBBBBBB..BBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 B.BBBBB.BBBBB.B.BBB.BBBBBBBBBBBBBBB..BB.BB.BB.B..BBBBBBB.BB..BBBBBBBBBBBBBBBBBBW.BBBBBBBBBBB.BBB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 BBBBBB.BBBBBBB.B..BBBBB..BBB.BBBB.B.BBB..BBBBBBBBBBBBBBBBBBW.BBBB.BBBBBB.BBBBB.BBBBBB.BBBBBBBBBB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 .B.BBBB.BBBBB.BB.BB..BBBBBBBBBBBBBBBBBBW..B.BBBBBBBBBBBBBB.BBBBBBBBBBBBBBBBB.BBBB.B.B.BBBBBB.BBB
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBW.BBB.BBBBBBBBBBBB.BB.BB.BBB.BBBBBBBBBB..BBBBBBBBBBB.BBBBBBBBBB..B.BBB.BBBBB.
<5 bytes omitted>
用户输出
18
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.BBBBBBBBW.BBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
100 .BBW.BBBBBBBBBBBBBBBBBB.BB.BBBBBBBBB.BBBBBW.BBB.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
2
系统信息
Exited with return code 0
100 ..BBBBBBBBBB.BBBBB.WBB.BBBBBB.BBBBW.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBW.BBBBBBBBBBBBBBB.BBBBBBBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
100 .BB.BBBBBBB.BBBBBBBB.WBBBBBBBBBBBBBB.BBBW.B.WB.BBBBBBBBBBBBBBBBBBBBB.BBBB.BBBBBBBBBBBB.WBBBBBBBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
100 .WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.WWWWWBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
39
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBWWWWWWWWWWWWW.BBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
60
系统信息
Exited with return code 0
100 .WBBBBBBBB.WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
27
系统信息
Exited with return code 0
100 .BBBBB.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
100 .WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.WWWBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.BBBBBBB.BBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
100 .BBBBBBBBB.BWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW.BBBBWWW.BBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
100 .W.WWWBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.WWWWWWWWWWWWWWWWWWWWWBBBBBB.BBBBBBBBBBBBBBBBB.BBBBBBBBBBBBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
100 .BWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW.BBBBBBBB.BBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
1
系统信息
Exited with return code 0
100 .WBBBBBBBBBBBBBBBBBBBBB.WWWWWWWWWWWWBBBB..WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW.WWWWWWBBBBB.WWWWWWW
<5 bytes omitted>
用户输出
4
系统信息
Exited with return code 0
100 .BBBBBBBBBBBBBBBBBBBBBBBBBBB.BBBBBBBBBBBWWWWW.WWWWWWWWWWWWWWWWWW.WW.WWWWWWWWWWWWW.BBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
16
系统信息
Exited with return code 0
100 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
<5 bytes omitted>
用户输出
0
系统信息
Exited with return code 0