結果
問題 | No.232 めぐるはめぐる (2) |
ユーザー |
![]() |
提出日時 | 2021-11-18 18:50:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 951 bytes |
コンパイル時間 | 4,081 ms |
コンパイル使用メモリ | 255,420 KB |
最終ジャッジ日時 | 2025-01-25 19:19:15 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:42:42: warning: ‘k’ may be used uninitialized [-Wmaybe-uninitialized] 42 | ans.push_back(s[k]); | ^ main.cpp:26:29: note: ‘k’ was declared here 26 | int k; | ^
ソースコード
#include <stdio.h>#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using mint = modint1000000007;using namespace std;#define rep(i,n) for (int i = 0; i < (n); ++i)#define Inf 1000000001int main(){vector dx = {1,1,0,-1,-1,-1,0,1}, dy = {0,1,1,1,0,-1,-1,-1};vector<string> s = {">",">^","^","^<","<","<v","v","v>"};int T,A,B;cin>>T>>A>>B;rep(i,8){int a = 0,b = 0;vector<string> ans(1,s[i]);a += dx[i];b += dy[i];rep(j,T-1){int k;if(a==A&&b==B)k = 0;else if(a==A){if(b<B)k = 0;else k = 4;}else if(b==B){if(a<A)k = 2;else k = 6;}else{if(a<A&&b<B)k = 1;if(a>A&&b<B)k = 3;if(a>A&&b>B)k = 5;if(a>A&&b>B)k = 7;}ans.push_back(s[k]);a += dx[k];b += dy[k];//if(i==1)cout<<k<<endl;}if(a==A&&b==B){cout<<"YES"<<endl;rep(i,T)cout<<ans[i]<<endl;return 0;}}cout<<"NO"<<endl;return 0;}