結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
![]() |
提出日時 | 2020-11-20 23:30:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 1,005 bytes |
コンパイル時間 | 2,916 ms |
コンパイル使用メモリ | 199,880 KB |
最終ジャッジ日時 | 2025-01-16 03:26:03 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
#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==0){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(z%3==2){if(s[i]=='b') x--;else if(s[i]=='c') y--;}m1.insert({x,y});}else if(i%2==1){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(z%3==2){if(s[i]=='c') x++;else if(s[i]=='b') y++;}m0.insert({x,y});}}cout<<m0.size()+m1.size()<<endl;return 0;}