結果
問題 | No.1376 Simple LPS Problem |
ユーザー |
![]() |
提出日時 | 2021-02-05 21:59:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 1,210 bytes |
コンパイル時間 | 1,624 ms |
コンパイル使用メモリ | 167,756 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 12:29:26 |
合計ジャッジ時間 | 3,536 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 60 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N, K; cin >> N >> K; if (K == 1){ if (N == 1){ cout << "0" << endl; } else if (N == 2){ cout << "01" << endl; } else { cout << -1 << endl; } } else if (K == 2){ if (N == 2){ cout << "00" << endl; } else if (N == 3){ cout << "001" << endl; } else if (N == 4){ cout << "0011" << endl; } else { cout << -1 << endl; } } else if (K == 3){ if (N == 3){ cout << "000" << endl; } else if (N == 4){ cout << "0001" << endl; } else if (N == 5){ cout << "00011" << endl; } else if (N == 6){ cout << "000111" << endl; } else if (N == 7){ cout << "0001011" << endl; } else if (N == 8){ cout << "00010111" << endl; } else { cout << -1 << endl; } } else { string S; S += '1'; for (int i = 0; i < K - 2; i++){ S += '0'; } S += "1101"; for (int i = 0; i < K - 2; i++){ S += '0'; } for (int i = 0; i < K - 2; i++){ S += '1'; } S += '0'; string T; for (int i = 0; i < N; i++){ T += S[i % (K * 3)]; } cout << T << endl; } }