結果

問題 No.232 めぐるはめぐる (2)
ユーザー suzuishisuzuishi
提出日時 2022-04-17 19:52:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,523 bytes
コンパイル時間 1,766 ms
コンパイル使用メモリ 173,464 KB
実行使用メモリ 8,152 KB
最終ジャッジ日時 2023-08-27 03:54:44
合計ジャッジ時間 6,161 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 129 ms
8,152 KB
testcase_02 WA -
testcase_03 AC 127 ms
7,508 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 35/40
#include <bits/stdc++.h>
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) a.begin(),a.end()
#define PB(a) push_back(a)
#define FS first
#define SD second
#define SEP(i,n) (i==n-1?'\n':' ')
#define PUTNUM(a,b,c) (a==b?c:a)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using VI=vector<int>;
using VVI=vector<VI>;
using VVVI=vector<VVI>;
using VL=vector<ll>;
using VVL=vector<VL>;
using VVVL=vector<VVL>;
using VB=vector<bool>;
using VVB=vector<VB>;
using VP=vector<P>;
using VVP=vector<VP>;
using VS=vector<string>;
const int dx[]={0,-1,1,0},dy[]={-1,0,0,1};
//const int dx[]={-1,0,1,-1,1,-1,0,1},dy[]={-1,-1,-1,0,0,1,1,1};
template<typename T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T>T eucld(T a,T b){if(a<b)swap(a,b);while(a%b){T q=a%b;a=b;b=q;}return b;}
ll modpow(ll a,ll k,ll m=MOD){a%=m;if(a==0)return 0;ll r=1;while(k>0){if(k&1)r=r*a%m;a=a*a%m;k>>=1;}return r;}
struct UnionFind{VI v;UnionFind(int n):v(n){rep(i,n)v[i]=i;}int root(int x){if(v[x]==x)return x;return v[x]=root(v[x]);}void unite(int x,int y){int a=root(x),b=root(y);if(a!=b)v[a]=b;}bool same(int x,int y){return root(x)==root(y);}};

int main(void) {
   cin.tie(0);
   ios::sync_with_stdio(0);
   cout << fixed << setprecision(7);
   int t,a,b; cin >> t >> a >> b;
   int s=min(a,b)+abs(a-b);
   VS ans;
   if(s>t) {
      cout << "NO" << endl;
      return 0;
   }
   string dir="^";
   if(a<b) dir=">";
   if(t-s==1) {
      if(abs(a-b)>=1) {
         rep(i,min(a,b)) ans.PB(">^");
         rep(i,abs(a-b)-1) ans.PB(dir);
         ans.PB(">^");
         if(a<b) ans.PB("v");
         else ans.PB("<");
      } else if(min(a,b)>=1) {
         rep(i,min(a,b)-1) ans.PB(">^");
         ans.PB(">");
         ans.PB("^");
         rep(i,abs(a-b)) ans.PB(dir);
      } else {
         cout << "NO" << endl;
         return 0;
      }
   } else {
      rep(i,min(a,b)) ans.PB(">^");
      rep(i,abs(a-b)) ans.PB(dir);
      if((s-t)&1) {
         rep(i,(s-t-3)/2) {
            ans.PB(">");
            ans.PB("<");
         }
         ans.PB(">");
         ans.PB("^");
         ans.PB("<v");
      } else {
         rep(i,(s-t)/2) {
            ans.PB(">");
            ans.PB("<");
         }
      }
   }
   cout << "YES" << endl;
   for(auto i:ans) cout << i << endl;
   return 0;
}
0