結果

問題 No.1292 パタパタ三角形
ユーザー umezoumezo
提出日時 2020-11-20 23:07:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 970 bytes
コンパイル時間 2,170 ms
コンパイル使用メモリ 206,348 KB
実行使用メモリ 12,904 KB
最終ジャッジ日時 2023-09-30 19:54:28
合計ジャッジ時間 3,444 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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(){
  string s;
  cin>>s;
  
  int n=s.size();
  
  int x=0,y=0;
  set<pair<int,int>> m0,m1;
  m0.insert({0,0});
  for(int i=0;i<n;i++){
    int z=x-y+33333333;
    if(i%2==1){
      if(z%3==0){
        if(s[i]=='c') x--;
        else if(s[i]=='a') y--; 
      }
      else if(z%3==1){
        if(s[i]=='a') x--;
        else if(s[i]=='b') y--; 
      }
      else{
        if(s[i]=='b') x--;
        else if(s[i]=='c') y--; 
      }
      m1.insert({x,y});
    }
    else{
      if(z%3==0){
        if(s[i]=='a') x++;
        else if(s[i]=='c') y++; 
      }
      else if(z%3==1){
        if(s[i]=='b') x++;
        else if(s[i]=='a') y++; 
      }
      else{
        if(s[i]=='c') x++;
        else if(s[i]=='b') y++; 
      }
      m0.insert({x,y});
    }
  }
  cout<<m0.size()+m1.size()<<endl;

  return 0;
}
0