結果

問題 No.232 めぐるはめぐる (2)
ユーザー 沙耶花沙耶花
提出日時 2021-11-18 18:52:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,638 bytes
コンパイル時間 4,751 ms
コンパイル使用メモリ 263,676 KB
実行使用メモリ 10,952 KB
最終ジャッジ日時 2023-08-27 06:48:07
合計ジャッジ時間 8,817 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 168 ms
10,652 KB
testcase_01 AC 134 ms
10,520 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 309 ms
10,692 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 99 ms
5,204 KB
testcase_08 WA -
testcase_09 AC 195 ms
6,964 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:80:58: 警告: ‘k’ may be used uninitialized [-Wmaybe-uninitialized]
   80 |                                         ans.push_back(s[k]);
      |                                                          ^
main.cpp:64:45: 備考: ‘k’ はここで定義されています
   64 |                                         int k;
      |                                             ^
main.cpp:42:42: 警告: ‘k’ may be used uninitialized [-Wmaybe-uninitialized]
   42 |                         ans.push_back(s[k]);
      |                                          ^
main.cpp:26:29: 備考: ‘k’ はここで定義されています
   26 |                         int k;
      |                             ^

ソースコード

diff #

#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 1000000001



int 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;
		}
	}
	
	if(T>=2){
		rep(i,8){
			rep(ii,8){
				int a = 0,b = 0;
				vector<string> ans(1,s[i]);
				a += dx[i];
				b += dy[i];
				ans.push_back(s[ii]);
				a += dx[ii],b += dy[ii];
				rep(j,T-2){
					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;
}
0