結果

問題 No.232 めぐるはめぐる (2)
ユーザー kk
提出日時 2021-02-18 16:44:14
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 794 bytes
コンパイル時間 5,428 ms
コンパイル使用メモリ 200,400 KB
実行使用メモリ 9,376 KB
最終ジャッジ日時 2023-10-13 00:34:07
合計ジャッジ時間 5,133 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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