結果
| 問題 |
No.2894 Monotonic Intervals
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 12:54:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 676 bytes |
| コンパイル時間 | 1,126 ms |
| コンパイル使用メモリ | 114,080 KB |
| 最終ジャッジ日時 | 2025-02-24 17:28:42 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
#include<iostream>
#include<string>
#include<queue>
#include<vector>
#include<cassert>
#include<random>
#include<set>
#include<map>
#include<cassert>
#include<unordered_map>
#include<bitset>
#include<numeric>
#include<algorithm>
using namespace std;
using ll = long long;
const int inf=1<<30;
const ll INF=1LL<<62;
typedef pair<int,ll> P;
typedef pair<int,P> PP;
const ll MOD=998244353;
const int dy[]={0,1,0,-1};
const int dx[]={1,0,-1,0};
int main(){
int N;
cin>>N;
string S;
cin>>S;
vector<char> c;
c.push_back(S[0]);
for(int i=1;i<N;i++){
if(S[i]!=c.back()){
c.push_back(S[i]);
}
}
cout<<c.size()<<endl;
}