結果

問題 No.1292 パタパタ三角形
ユーザー CleyLCleyL
提出日時 2023-03-29 14:46:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 77,740 KB
実行使用メモリ 5,212 KB
最終ジャッジ日時 2023-10-21 06:18:31
合計ジャッジ時間 1,728 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 9 ms
4,348 KB
testcase_15 AC 8 ms
4,348 KB
testcase_16 AC 8 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;
int main(){
  string s;cin>>s;
  pair<int,int> nw = {0,0};
  set<pair<int,int>> A;
  A.insert(nw);
  for(int i = 0; s.size() > i; i++){
    if(i%2){
      if(s[i] == 'a')nw.second--;
      else if(s[i] == 'b')nw.first++;
      else nw.second++;
    }else{
      if(s[i] == 'a')nw.second++;
      else if(s[i] == 'b')nw.first--;
      else nw.second--;
    }
    A.insert(nw);
  }
  cout << A.size() << endl;
}
0