結果

問題 No.232 めぐるはめぐる (2)
ユーザー not_522not_522
提出日時 2015-08-04 09:06:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 129 ms / 1,000 ms
コード長 933 bytes
コンパイル時間 1,672 ms
コンパイル使用メモリ 144,008 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-12 13:40:56
合計ジャッジ時間 3,597 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  int t, a, b;
  cin >> t >> a >> b;
  if ((a == 0 && b == 0 && t == 1) || max(a, b) > t) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  if ((max(a, b) - t) % 2) {
    if (a && b) {
      cout << "^" << endl;
      cout << ">" << endl;
      --a, --b, t -= 2;
    } else if (a) {
      cout << "^>" << endl;
      cout << "<" << endl;
      --a, t -= 2;
    } else if (b) {
      cout << "^>" << endl;
      cout << "v" << endl;
      --b, t -= 2;
    } else {
      cout << "v<" << endl;
      cout << ">" << endl;
      cout << "^" << endl;
      t -= 3;
    }
  }
  for (int i = 0; i < t; ++i) {
    if (a && b) {
      cout << "^>" << endl;
      --a, --b;
    } else if (a) {
      cout << "^" << endl;
      --a;
    } else if (b) {
      cout << ">" << endl;
      --b;
    } else {
      cout << "v<" << endl;
      ++a, ++b;
    }
  }
}
0