結果
| 問題 | No.2279 OR Insertion |
| コンテスト | |
| ユーザー |
C
|
| 提出日時 | 2026-10-20 23:33:10 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 52 ms / 2,000 ms |
| + 799µs | |
| コード長 | 1,054 bytes |
| 記録 | |
| コンパイル時間 | 6,330 ms |
| コンパイル使用メモリ | 387,496 KB |
| 実行使用メモリ | 9,920 KB |
| 最終ジャッジ日時 | 2026-10-20 23:33:30 |
| 合計ジャッジ時間 | 9,981 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge6_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 46 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
#include <boost/polygon/point_data.hpp>
#include <boost/polygon/voronoi.hpp>
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(x) begin(x),end(x)
#define sz(x) (int)(x).size()
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vi>;
using pll=pair<ll,ll>;
using pi=pair<int,int>;
using mint=modint998244353;
// using BoostPoint=boost::polygon::point_data<int>;
// using Voronoi=boost::polygon::voronoi_diagram<double>;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll N;
string s;
cin>>N>>s;
mint total=mint(2).pow(N-1);
mint ans=0;
rep(k,0,N){
vector<mint> dp(N+1),pref(N+1);
dp[0]=1,pref[0]=1;
rep(j,1,N+1){
dp[j]=pref[j-1];
if(j>k&&s[j-k-1]=='1'){
dp[j]-=pref[j-k-1];
}
pref[j]=pref[j-1]+dp[j];
}
mint cnt=total-dp[N];
ans+=mint(2).pow(k)*cnt;
}
cout<<ans.val()<<'\n';
}
C