結果
問題 | No.2035 Tunnel |
ユーザー |
![]() |
提出日時 | 2022-04-30 19:20:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 816 bytes |
コンパイル時間 | 3,677 ms |
コンパイル使用メモリ | 229,660 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 23:14:19 |
合計ジャッジ時間 | 5,389 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>#if __has_include(<atcoder/all>)#include <atcoder/all>using namespace atcoder;#endifusing namespace std;#define ll long long#define rep(i, n) for (ll i = 0; i < n; ++i)#define rep_up(i, a, n) for (ll i = a; i < n; ++i)#define rep_down(i, a, n) for (ll i = a; i >= n; --i)#define P pair<ll, ll>#define pb push_back#define bit_count(x) __builtin_popcountll(x)#define gcd(a,b) __gcd(a,b)#define lcm(a,b) a / gcd(a,b) * b#define all(v) v.begin(), v.end()int main(){ll n;string s;cin>>n;cin>>s;assert(1<=n&&n<=300000);assert(n==s.size());rep(i,n){assert(s[i]=='#'||s[i]=='.');}reverse(all(s));ll ans=-1000000000;rep(i,n){if(s[i]=='#'){ans=max(ans+2,i+1);}}cout<<ans<<endl;}