結果
| 問題 |
No.232 めぐるはめぐる (2)
|
| コンテスト | |
| ユーザー |
not_522
|
| 提出日時 | 2015-08-04 09:06:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 133 ms / 1,000 ms |
| コード長 | 933 bytes |
| コンパイル時間 | 1,574 ms |
| コンパイル使用メモリ | 158,428 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 12:38:33 |
| 合計ジャッジ時間 | 3,370 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#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;
}
}
}
not_522