結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
![]() |
提出日時 | 2020-11-22 14:16:40 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 617 bytes |
コンパイル時間 | 642 ms |
コンパイル使用メモリ | 68,632 KB |
実行使用メモリ | 12,928 KB |
最終ジャッジ日時 | 2024-07-23 16:29:31 |
合計ジャッジ時間 | 1,586 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 8 |
コンパイルメッセージ
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){x--;swap(n[0],n[2]);}else if(n[1]==t){y--;swap(n[0],n[1]);}else{x++;swap(n[1],n[2]);}}else{if(n[0]==t){y++;swap(n[0],n[1]);}else if(n[1]==t){x--;swap(n[1],n[2]);}else{x++;swap(n[0],n[2]);}}S.insert(make_pair(x,y));}cout<<S.size()<<endl;}