結果
問題 | No.2035 Tunnel |
ユーザー |
![]() |
提出日時 | 2022-08-12 21:36:39 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 330 bytes |
コンパイル時間 | 2,876 ms |
コンパイル使用メモリ | 247,148 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2024-09-23 01:21:25 |
合計ジャッジ時間 | 3,800 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int N; string S; cin>>N>>S; vector<int> A={}; for(int i=0;i<N;i++)if(S[i] == '#') A.push_back(i); N = A.size(); int now = 0; for(int i=N-2;i>=0;i--){ now = max(0ll,now-(A[i+1]-A[i]-2)); } cout<<S.size()+now-A[0]<<endl; }