結果

問題 No.232 めぐるはめぐる (2)
ユーザー k
提出日時 2021-02-18 16:44:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 135 ms / 1,000 ms
コード長 794 bytes
コンパイル時間 1,971 ms
コンパイル使用メモリ 195,656 KB
最終ジャッジ日時 2025-01-18 22:19:28
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int t, a, b;
  cin >> t >> a >> b;

  if (a > t || b > t)
    cout << "NO" << endl;
  else {
    vector<string> sa(t), sb(t);
    for (int i = 0; i < a; i++)
      sa[i] = "^";
    for (int i = a; i + 1 < t; i += 2) {
      sa[i] = "^";
      sa[i+1] = "v";
    }

    for (int i = 0; i < b; i++)
      sb[i] = ">";
    for (int i = b; i + 1 < t; i += 2) {
      sb[i] = ">";
      sb[i+1] = "<";
    }
    
    if (t == 1 && sa[0] == "" && sb[0] == "")
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      for (int i = 0; i < t; i++) {
        cout << sa[i] + sb[t-1-i] << endl;
      }
    }
  }
  
  return 0;
}
0