結果

問題 No.1292 パタパタ三角形
ユーザー umezoumezo
提出日時 2020-11-20 23:00:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 965 bytes
コンパイル時間 1,999 ms
コンパイル使用メモリ 206,436 KB
実行使用メモリ 15,852 KB
最終ジャッジ日時 2023-09-30 19:50:50
合計ジャッジ時間 3,154 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 28 ms
5,840 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;
  map<pair<int,int>,int> m0,m1;
  m0[{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[{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[{x,y}]++;
    }      
  }
  cout<<m0.size()+m1.size()<<endl;

  return 0;
}
0