結果
問題 | No.1376 Simple LPS Problem |
ユーザー | bachoppi |
提出日時 | 2021-02-05 22:44:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 1,151 bytes |
コンパイル時間 | 1,056 ms |
コンパイル使用メモリ | 115,248 KB |
最終ジャッジ日時 | 2025-01-18 12:46:19 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 60 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> #include<functional> #include<assert.h> #include<numeric> using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=998244353; #define pai 3.141592653589793238462643383279 int main(){ int n, k; cin >> n>> k; if(k<=3){ if(k==3 && n==7){ cout << "0001011" << endl; return 0; } if(k==3 && n==8){ cout << "00010111" << endl; return 0; } if(n>2*k){ cout << -1 << endl; return 0; } int ans[2*k] = {}; for(int i=k; i<2*k; i++){ ans[i] = 1; } rep(i, n){ cout << ans[i]; } cout << endl; return 0; } int ans[k+2] = {}; rep(i, k+2){ if(i!=0 && i!=k-1 && i!=k) ans[i] = 1; } rep(i, n/(k+2)){ rep(j, k+2){ cout << ans[j]; } } rep(i, n%(k+2)){ cout << ans[i]; } cout << endl; }