結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
![]() |
提出日時 | 2020-11-22 14:33:23 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 653 bytes |
コンパイル時間 | 1,275 ms |
コンパイル使用メモリ | 67,832 KB |
実行使用メモリ | 12,916 KB |
最終ジャッジ日時 | 2024-07-23 16:30:34 |
合計ジャッジ時間 | 1,946 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 WA * 13 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#include<iostream>#include<set>#include<algorithm>using namespace std;string s;set<pair<int,int> >S;main(){cin>>s;int x=0,y=0;string n="abc";S.insert(make_pair(x,y));for(char t:s){if(x%2==0){if(n[0]==t){y++;swap(n[0],n[2]);}else if(n[1]==t){x++;y--;swap(n[0],n[1]);}else{x--;y--;swap(n[1],n[2]);}}else{if(n[0]==t){y++;x++;swap(n[0],n[1]);}else if(n[1]==t){x--;y++;swap(n[1],n[2]);}else{y--;swap(n[0],n[2]);}}S.insert(make_pair(x,y));}cout<<S.size()<<endl;}