結果
| 問題 |
No.2035 Tunnel
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-14 04:15:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 470 bytes |
| コンパイル時間 | 790 ms |
| コンパイル使用メモリ | 68,420 KB |
| 最終ジャッジ日時 | 2025-02-09 11:22:34 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <iostream>
using namespace std;
int main()
{
int n;
string s;
cin >> n >> s;
for (int i = 0; i < n; i++)
{
if (s[i] == '#')
{
s = s.substr(i);
n = s.size();
break;
}
}
int c = 0;
int ans = n;
for (int i = 0; i < n; i++)
{
if (s[i] == '#')
{
c++;
}
ans = max(ans, n + c * 2 - i - 2);
}
cout << ans << endl;
}