結果

問題 No.2021 Not A but B
ユーザー umezoumezo
提出日時 2022-07-29 21:36:50
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 204,476 KB
実行使用メモリ 12,736 KB
最終ジャッジ日時 2023-09-26 19:48:49
合計ジャッジ時間 3,979 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 39 ms
9,300 KB
testcase_09 AC 40 ms
9,300 KB
testcase_10 AC 39 ms
9,180 KB
testcase_11 AC 38 ms
9,068 KB
testcase_12 AC 39 ms
8,976 KB
testcase_13 AC 39 ms
9,024 KB
testcase_14 AC 39 ms
9,272 KB
testcase_15 AC 39 ms
9,068 KB
testcase_16 AC 38 ms
9,052 KB
testcase_17 AC 37 ms
8,940 KB
testcase_18 AC 40 ms
9,304 KB
testcase_19 AC 39 ms
9,192 KB
testcase_20 AC 40 ms
9,248 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 3 ms
4,376 KB
testcase_27 AC 55 ms
12,420 KB
testcase_28 AC 54 ms
12,288 KB
testcase_29 AC 56 ms
12,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
  
  set<pair<int,int>> se;
  
  rep(i,n-1){
    if(s[i]=='A' && s[i+1]=='A') se.insert({i,i+1});
    else if(s[i]=='A') se.insert({i,-1});
    else if(s[i+1]=='A') se.insert({i+1,-1});
    else se.insert({-1,-1});
  }
  cout<<se.size()<<endl;
  
  
    
  return 0;
}
0