結果
問題 | No.2035 Tunnel |
ユーザー |
![]() |
提出日時 | 2022-08-12 21:48:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 337 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 31,360 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-23 02:04:08 |
合計ジャッジ時間 | 1,322 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <stdio.h>char x[300010];int last[300010];int main(){int a;scanf("%d",&a);scanf("%s",x+1);int p = a+1, ans = 0;last[a+1] = -1;for(int i=a;i>=1;i--){if(x[i]=='#'){if((a-i)<=last[p]) last[i] = last[p]+2;else last[i] = (a+1-i);ans = ans>last[i]?ans:last[i];p = i;}}printf("%d",ans);}