結果

問題 No.1376 Simple LPS Problem
ユーザー 👑 NachiaNachia
提出日時 2021-02-05 22:55:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 2,038 ms
コンパイル使用メモリ 194,812 KB
最終ジャッジ日時 2025-01-18 12:51:50
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 60
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int N,K;
string S="010011";
string ans;

int main(){
  cin>>N>>K;
  if(K>=4){
    ans=string(K,'1');
    while(ans.size()<N) ans+=S;
    ans.resize(N);
  }
  else if(K*2>=N){
    ans=string(K,'1')+string(N-K,'0');
  }
  else if(K==3 && N<=8){
    ans="11101000";
    ans.resize(N);
  }
  else{
    ans="-1";
  }
  cout<<ans<<endl;
  return 0;
}

0