結果
問題 | No.232 めぐるはめぐる (2) |
ユーザー |
![]() |
提出日時 | 2016-03-29 13:26:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 134 ms / 1,000 ms |
コード長 | 1,518 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 74,372 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 12:42:25 |
合計ジャッジ時間 | 2,443 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) int main() { int t,a,b; cin >> t >> a >> b; if(t < max(a,b) || (t == 1 && a == 0 && b == 0)){ cout << "NO" << endl; }else{ int nx = 0,ny = 0; cout << "YES" << endl; if(t - max(a,b) == 1){ if(a == b){ for(int i = 0;i < max(a,b) - 1;i++){ cout << ">^" << endl; } cout << ">" << endl << "^" << endl; }else{ for(int i = 0;i < min(a,b);i++){ cout << ">^" << endl; } int m = min(a,b); a -= m; b -= m; if(a == 0){ cout << ">^" << endl << "v" << endl; for(int i = 0;i < b - 1;i++){ cout << ">" << endl; } }else{ cout << ">^" << endl << "<" << endl; for(int i = 0;i < a - 1;i++){ cout << "^" << endl; } } } }else{ for(int i = 0;i < min(a,b);i++){ cout << ">^" << endl; t--; } int m = min(a,b); a -= m; b -= m; if(a == 0){ for(int i = 0;i < b;i++){ cout << ">" << endl; t--; } }else{ for(int i = 0;i < a;i++){ cout << "^" << endl; t--; } } while(t){ if(t % 2 == 1){ t -= 3; cout << ">^" << endl << "<" << endl << "v" << endl; }else if(t % 2 == 0){ t -= 2; cout << ">" << endl << "<" << endl; } } } } return 0; }