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