結果
問題 |
No.1924 3 color painting on a line
|
ユーザー |
![]() |
提出日時 | 2022-05-03 19:14:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 616 bytes |
コンパイル時間 | 2,412 ms |
コンパイル使用メモリ | 196,920 KB |
最終ジャッジ日時 | 2025-01-29 02:09:04 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 42 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; string s; cin>>n>>s; int cnt=0; deque<char> deq; rep(i,n) deq.push_back(s[i]); while(!deq.empty()){ cnt++; char a=deq.front(); deq.pop_front(); while(!deq.empty()){ if(deq.front()==a) deq.pop_front(); else break; } while(!deq.empty()){ if(deq.back()==a) deq.pop_back(); else break; } } cout<<cnt<<endl; return 0; }