結果

問題 No.1292 パタパタ三角形
ユーザー takumattakumat
提出日時 2020-11-20 22:31:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 2,528 bytes
コンパイル時間 4,934 ms
コンパイル使用メモリ 214,696 KB
最終ジャッジ日時 2025-01-16 02:40:21
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

//#include <atcoder/all>
#include <bits/stdc++.h>
typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007LL; //998244353LL
template<class _T> static void get(_T& a) {
std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
if (a < (_T)0) {
a *= (_T)-1;
}
return a;
}
static void A_task();
int main()
{
A_task();
fflush(stdout);
return 0;
}
enum {
LeftUpper = 0,
RightUpper,
Bottom,
LeftUnder,
RightUnder,
Top,
};
static std::pair<int, int> rot(std::map<int, char>& dir, std::pair<int, int> center, char edge)
{
int nowEdge = 0;
for (auto d : dir) {
if (d.second == edge) {
nowEdge = d.first;
}
}
int x = 0, y = 0;
switch (nowEdge) {
case LeftUpper:
dir[Top] = dir[RightUpper];
dir[LeftUnder] = dir[Bottom];
dir[RightUnder] = dir[LeftUpper];
dir[RightUpper] = dir[Bottom] = dir[LeftUpper] = 0;
x = 3;
y = 1;
break;
case RightUpper:
dir[Top] = dir[LeftUpper];
dir[RightUnder] = dir[Bottom];
dir[LeftUnder] = dir[RightUpper];
dir[RightUpper] = dir[Bottom] = dir[LeftUpper] = 0;
x = -3;
y = 1;
break;
case Bottom:
dir[LeftUnder] = dir[LeftUpper];
dir[RightUnder] = dir[RightUpper];
dir[Top] = dir[Bottom];
dir[RightUpper] = dir[Bottom] = dir[LeftUpper] = 0;
x = 0;
y = -2;
break;
case LeftUnder:
dir[LeftUpper] = dir[Top];
dir[Bottom] = dir[RightUnder];
dir[RightUpper] = dir[LeftUnder];
dir[Top] = dir[LeftUnder] = dir[RightUnder] = 0;
x = 3;
y = -1;
break;
case RightUnder:
dir[RightUpper] = dir[Top];
dir[Bottom] = dir[LeftUnder];
dir[LeftUpper] = dir[RightUnder];
dir[Top] = dir[LeftUnder] = dir[RightUnder] = 0;
x = -3;
y = -1;
break;
case Top:
dir[LeftUpper] = dir[LeftUnder];
dir[RightUpper] = dir[RightUnder];
dir[Bottom] = dir[Top];
dir[Top] = dir[LeftUnder] = dir[RightUnder] = 0;
x = 0;
y = 2;
break;
}
return std::pair<int, int>(center.first + x, center.second + y);
}
static void A_task()
{
std::string ptn;
get(ptn);
std::map<std::pair<int, int>, int> points;
std::map<int, char> dir;
dir[LeftUpper] = 'c';
dir[Bottom] = 'a';
dir[RightUpper] = 'b';
std::pair<int, int> center(0, 1);
points[center] = 1;
int len = ptn.length();
for (int i = 0; i < len; i++) {
center = rot(dir, center, ptn[i]);
points[center] = 1;
}
printf("%d\n", (int)points.size());
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0