結果
問題 |
No.1376 Simple LPS Problem
|
ユーザー |
![]() |
提出日時 | 2021-02-09 22:32:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,615 bytes |
コンパイル時間 | 1,970 ms |
コンパイル使用メモリ | 196,024 KB |
最終ジャッジ日時 | 2025-01-18 16:46:42 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 RE * 1 |
other | AC * 20 WA * 12 RE * 28 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; #define mod 998244353 using ll=long long; const int INF=1000000000; const ll LINF=1001002003004005006ll; int dx[]={1,0,-1,0},dy[]={0,1,0,-1}; template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;} struct IOSetup{ IOSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(12); } } iosetup; template<typename T> ostream &operator<<(ostream &os,const vector<T>&v){ for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" "); return os; } template<typename T> istream &operator>>(istream &is,vector<T>&v){ for(T &x:v)is>>x; return is; } int b(int x,int y){ return ((x>>y)&1); } int g(int a,int k){ int ret=0; rep(i,k){ for(int j=i+1;j<=k;j++){ bool flag=true; for(int t=0;t<j-i;t++){ if(b(a,i+t)!=b(a,j-1-t)) flag=false; if(flag) chmax(ret,j-i); } } } return ret; } void test(){ const int n=9; int res=INF; for(int i=0;i<(1<<n);i++){ auto gr=g(i,n); chmin(res,gr); cout<<bitset<n>(i)<<" : "<<g(i,n)<<endl; } cout<<"!, "<<res<<endl; } signed main(){ // test(); int n,k;cin>>n>>k; if(2*k<n){ cout<<-1<<endl; return 0; } assert(false); return 0; }