結果
| 問題 |
No.2035 Tunnel
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-14 04:12:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 472 bytes |
| コンパイル時間 | 728 ms |
| コンパイル使用メモリ | 68,264 KB |
| 最終ジャッジ日時 | 2025-02-09 11:22:31 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 7 |
ソースコード
#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++)
{
ans = max(ans, n + c * 2 - (i + 1));
if (s[i] == '#')
{
c++;
}
}
cout << ans << endl;
}