結果
問題 |
No.2035 Tunnel
|
ユーザー |
|
提出日時 | 2022-08-12 22:24:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 597 bytes |
コンパイル時間 | 2,109 ms |
コンパイル使用メモリ | 197,436 KB |
最終ジャッジ日時 | 2025-01-30 21:17:45 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 23 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; string S; cin >> N >> S; int L = 0; while(S[L] != '#') L++; vector<pair<char,ll>> v; v.push_back({S[0], 1}); for(int i = 1; i < N; i++) { if(v.back().first == S[i]) { v.back().second++; } else { v.push_back({S[i], 1}); } } ll ans = 0; for(auto [ch, cnt] : v) if(ch == '#') ans = max(ans, cnt); cout << ans + N - L - 1 << endl; }