結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 136 ms
10,508 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 44 ms
10,352 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 14 ms
5,220 KB
testcase_08 WA -
testcase_09 AC 27 ms
7,352 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
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;
		}
	}
	
	cout<<"NO"<<endl;
	
	return 0;
}
0