結果

問題 No.232 めぐるはめぐる (2)
ユーザー 0w10w1
提出日時 2016-11-29 15:27:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,174 bytes
コンパイル時間 1,670 ms
コンパイル使用メモリ 168,720 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 13:30:08
合計ジャッジ時間 4,277 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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