結果
問題 | No.1376 Simple LPS Problem |
ユーザー |
![]() |
提出日時 | 2021-02-10 12:04:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,404 bytes |
コンパイル時間 | 2,399 ms |
コンパイル使用メモリ | 193,424 KB |
最終ジャッジ日時 | 2025-01-18 16:59:34 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 56 WA * 4 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define FOR(i,a,b) for(int i=(a);i<(b);++i)#define REP(i,n) FOR(i,0,n)#define ALL(v) begin(v),end(v)template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }using ll = long long;using pii = pair<int, int>;constexpr ll INF = 1ll<<30;constexpr ll longINF = 1ll<<60;constexpr ll MOD = 1000000007;constexpr bool debug = false;//---------------------------------//int main() {int N, K;cin >> N >> K;if (N <= 8) {REP(i, 1 << N) {int cur = 1;REP(j, N) {FOR(k, 1, N) {int l = j - k, r = j + k;if (l < 0 || r >= N) break;if ((i >> l & 1) == (i >> r & 1)) chmax(cur, k * 2 + 1);else break;}FOR(k, 0, N) {int l = j - k, r = j + k + 1;if (l < 0 || r >= N) break;if ((i >> l & 1) == (i >> r & 1)) chmax(cur, (k + 1) * 2);else break;}}if (cur == K) {REP(j, N) putchar(i >> j & 1 ? '1' : '0');puts("");return 0;}}puts("-1");}else {if (K < 4) puts("-1");else {string ans(K, '0');ans += "10";const string s = "110010110010";const int dif = N - ans.size();REP(i, dif) ans += s[i % s.size()];cout << ans << endl;}}}