結果
問題 |
No.2035 Tunnel
|
ユーザー |
|
提出日時 | 2022-08-12 22:33:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 529 bytes |
コンパイル時間 | 2,037 ms |
コンパイル使用メモリ | 193,628 KB |
最終ジャッジ日時 | 2025-01-30 21:27:23 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 4 WA * 24 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main () { int N; cin >> N; string s; cin >> s; long long ans = 0; long long las = -1; long long cnt = 0; for (int i = N - 1; i >= 0; i --) { if (s[i] == '#') { cnt ++; if (i < N - 1 && s[i + 1] == '#') { las ++; } else { las = 0; } ans = max(ans, las + N - i); ans = max(ans, (cnt*(cnt+1))/2); } } cout << ans << endl; }