結果
| 問題 |
No.1292 パタパタ三角形
|
| コンテスト | |
| ユーザー |
madoka
|
| 提出日時 | 2020-11-22 15:07:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 693 bytes |
| コンパイル時間 | 700 ms |
| コンパイル使用メモリ | 68,976 KB |
| 実行使用メモリ | 12,912 KB |
| 最終ジャッジ日時 | 2024-07-23 16:31:33 |
| 合計ジャッジ時間 | 1,508 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 10 |
コンパイルメッセージ
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));
long long cnt;
cnt=0;
for(char t:s)
{
if(cnt%2==0)
{
if(n[0]==t)
{
y++;
swap(n[1],n[2]);
}
else if(n[1]==t)
{
x++;
y--;
swap(n[0],n[2]);
}
else
{
x--;
y--;
swap(n[0],n[1]);
}
}
else
{
if(n[0]==t)
{
y--;
swap(n[1],n[2]);
}
else if(n[1]==t)
{
x++;
y++;
swap(n[0],n[2]);
}
else
{
x--;
y++;
swap(n[0],n[1]);
}
}
cnt++;
S.insert(make_pair(x,y));
}
cout<<S.size()<<endl;
}
madoka