結果

問題 No.232 めぐるはめぐる (2)
ユーザー 0w10w1
提出日時 2016-11-29 15:29:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 125 ms / 1,000 ms
コード長 1,174 bytes
コンパイル時間 1,564 ms
コンパイル使用メモリ 167,912 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 13:47:12
合計ジャッジ時間 3,627 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
4,348 KB
testcase_01 AC 125 ms
4,352 KB
testcase_02 AC 123 ms
4,348 KB
testcase_03 AC 125 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,356 KB
testcase_08 AC 86 ms
4,348 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 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,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const string msg[] = { "NO", "YES" };

signed main(){
  int T, A, B; cin >> T >> A >> B;
  if( max( A, B ) > T or ( T == 1 and A == 0 and B == 0 ) )
    cout << msg[ 0 ] << endl, exit( 0 );
  cout << msg[ 1 ] << endl;
  int mov = T - ( max( A, B ) - min( A, B ) ) - min( A, B );
  for( int i = 0; i < max( A, B ) - min( A, B ); ++i ){
    if( mov == 1 ){
      if( A == max( A, B ) )
        cout << "v^"[ A > 0 ] << ">" << endl,
        cout << "<" << endl;
      else
        cout << "<>"[ B > 0 ] << "^" << endl,
        cout << "v" << endl;
      --mov;
      continue;
    }
    if( A == max( A, B ) )
      cout << "v^"[ A > 0 ] << endl;
    else
      cout << "<>"[ B > 0 ] << endl; 
  }
  for( int i = 0; i < min( A, B ); ++i ){
    if( mov == 1 ){
      cout << "<>"[ B > 0 ] << endl;
      cout << "v^"[ A > 0 ] << endl;
      --mov;
      continue; 
    }
    cout << "<>"[ B > 0 ] << "v^"[ A > 0 ] << endl;
  }
  if( mov & 1 ){
    cout << ">^" << endl;
    cout << "v" << endl;
    cout << "<" << endl;
    mov -= 3; 
  }
  while( mov )
    cout << ">" << endl,
    cout << "<" << endl,
    mov -= 2;
  return 0;
}
0