結果

問題 No.478 一般門松列列
ユーザー 0w10w1
提出日時 2017-02-02 21:56:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,237 bytes
コンパイル時間 3,367 ms
コンパイル使用メモリ 166,596 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-25 18:08:41
合計ジャッジ時間 7,510 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,384 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< ll > vl;
typedef vector< vl > vvl;
typedef pair< int, int > pii;
typedef vector< pii > vp;
typedef vector< double > vd;
typedef vector< vd > vvd;
typedef vector< string > vs;

template< class T1, class T2 >
int upmin( T1 &x, T2 v ){
  if( x > v ){
    x = v;
    return 1;
  }
  return 0;
}

template< class T1, class T2 >
int upmax( T1 &x, T2 v ){
  if( x < v ){
    x = v;
    return 1;
  }
  return 0;
}

const int INF = 0x3f3f3f3f;

int N, K;

void init(){
  cin >> N >> K;
}

vi ans;

int get_nv( int v0, int v1 ){
  if( v0 < v1 ){
    return v0 - 1;
  }
  return v0 + 1;
}

void preprocess(){
  ans.emplace_back( ( int ) 5e8 );
  ans.emplace_back( ( int ) 5e8 - 1 );
  for( int i = 0, v0 = ans[ 0 ], v1 = ans[ 1 ]; i < K; ++i ){
    int nv = get_nv( v0, v1 );
    ans.emplace_back( nv );
    v0 = v1;
    v1 = nv;
  }
  for( int i = 0; i < N - 2 - K; ++i ){
    ans.emplace_back( ans.back() );
  }
}

void solve(){
  for( int i = 0; i < N; ++i ){
    cout << ans[ i ] << " \n"[ i + 1 == N ];
  }
}

signed main(){
  ios::sync_with_stdio( 0 );
  init();
  preprocess();
  solve();
  return 0;
}
0