結果
問題 | No.1376 Simple LPS Problem |
ユーザー |
![]() |
提出日時 | 2021-02-05 21:54:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,152 bytes |
コンパイル時間 | 1,588 ms |
コンパイル使用メモリ | 168,952 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-02 12:25:18 |
合計ジャッジ時間 | 3,585 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 59 WA * 1 |
ソースコード
#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 {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;}}