結果
問題 | No.1292 パタパタ三角形 |
ユーザー |
|
提出日時 | 2020-03-13 12:59:34 |
言語 | C++17 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 679 bytes |
コンパイル時間 | 1,964 ms |
使用メモリ | 12,896 KB |
最終ジャッジ日時 | 2023-02-06 13:56:22 |
合計ジャッジ時間 | 3,429 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,904 KB |
testcase_01 | AC | 1 ms
4,900 KB |
testcase_02 | AC | 2 ms
4,900 KB |
testcase_03 | AC | 1 ms
4,900 KB |
testcase_04 | AC | 1 ms
4,904 KB |
testcase_05 | AC | 2 ms
4,900 KB |
testcase_06 | AC | 1 ms
4,900 KB |
testcase_07 | AC | 29 ms
5,432 KB |
testcase_08 | AC | 29 ms
5,264 KB |
testcase_09 | AC | 50 ms
12,492 KB |
testcase_10 | AC | 53 ms
12,256 KB |
testcase_11 | AC | 52 ms
12,244 KB |
testcase_12 | AC | 64 ms
12,820 KB |
testcase_13 | AC | 62 ms
12,896 KB |
testcase_14 | AC | 7 ms
4,900 KB |
testcase_15 | AC | 9 ms
4,904 KB |
testcase_16 | AC | 8 ms
5,160 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:35:25: 警告: ‘ind’ はこの関数内初期化されずに使用されるかもしれません [-Wmaybe-uninitialized] 35 | if(ind==1)x++,y--; | ^~
ソースコード
#include <bits/stdc++.h> using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 10000000000000000 int main(){ vector<string> T = {"abc","cab","bca"}; string S; cin>>S; set<pair<int,int>> A; int x=0,y=0; A.insert({x,y}); int now = 0; for(int i=0;i<S.size();i++){ int ind; for(int j=0;j<3;j++){ if(T[now][j]==S[i]){ ind = j; break; } } now = (now+ind)%3; if(i%2==0){ if(ind==0)x--,y--; if(ind==1)x++,y--; if(ind==2)y+=2; } else{ if(ind==0)x++,y++; if(ind==1)y-=2; if(ind==2)x--,y++; } A.insert({x,y}); } cout<<A.size()<<endl; return 0; }