結果
| 問題 |
No.1376 Simple LPS Problem
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-02-05 22:52:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 578 bytes |
| コンパイル時間 | 1,821 ms |
| コンパイル使用メモリ | 195,600 KB |
| 最終ジャッジ日時 | 2025-01-18 12:50:28 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 60 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 10000000000000001
int main(){
int N,K;
cin>>N>>K;
vector<string> s = {"01","0011","00010111"};
if(K<=3){
if(s[K-1].size()>=N){
cout<<s[K-1].substr(0,N)<<endl;
}
else{
cout<<-1<<endl;
}
}
else{
string ans(K,'0');
int x = 2,y = 1;
while(ans.size()<=N){
rep(i,x)ans += '1';
rep(i,y)ans += '0';
if(x==1)x = 2;
else x = 1;
if(y==1)y = 2;
else y = 1;
}
cout<<ans.substr(0,N)<<endl;
}
return 0;
}
沙耶花