結果
| 問題 |
No.1376 Simple LPS Problem
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-02-05 22:10:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 700 bytes |
| コンパイル時間 | 5,404 ms |
| コンパイル使用メモリ | 192,920 KB |
| 最終ジャッジ日時 | 2025-01-18 12:28:23 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 53 WA * 7 |
ソースコード
#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;
if((N+1)/2 <= K){
string ans(N,'1');
rep(i,K)ans[i] = '0';
cout<<ans<<endl;
}
else{
string s = "";
int x = (K-1)/2 + 1;
int y = 1;
if(K%2==0)y++;
while(s.size()<=N){
if(x<=0)break;
rep(i,x){
s += '0';
}
x--;
if(K%2==0){
if(x==0){
y = K/2-1;
rep(i,y){
s += '1';
}
break;
}
}
rep(i,y){
s += '1';
}
y++;
}
if(s.size()<N){
cout<<-1<<endl;
return 0;
}
cout<<s.substr(0,N)<<endl;
}
return 0;
}
沙耶花