結果
| 問題 |
No.1292 パタパタ三角形
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-23 12:38:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 641 bytes |
| コンパイル時間 | 988 ms |
| コンパイル使用メモリ | 80,688 KB |
| 最終ジャッジ日時 | 2025-01-18 07:24:28 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 9 |
ソースコード
#line 1 "main.cpp"
#include <iostream>
#include <vector>
#include <string>
#include <set>
using namespace std;
const vector<pair<int, int>>
dxys{{0, -1}, {1, 0}, {-1, 0}, {0, 1}, {1, 0}, {-1, 0}};
void solve() {
string s;
cin >> s;
set<pair<int, int>> ss;
int x = 0, y = 0;
ss.emplace(x, y);
for (char c : s) {
int i = (c - 'a') * 2 + x;
if (y % 2 != 0) i += 3;
auto [dx, dy] = dxys[i % 6];
x += dx, y += dy;
ss.emplace(x, y);
}
cout << ss.size() << "\n";
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
solve();
return 0;
}