結果
| 問題 |
No.2772 Appearing Even Times
|
| コンテスト | |
| ユーザー |
FplusFplusF
|
| 提出日時 | 2024-06-02 12:10:52 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,873 ms / 4,000 ms |
| コード長 | 1,180 bytes |
| コンパイル時間 | 3,283 ms |
| コンパイル使用メモリ | 246,344 KB |
| 実行使用メモリ | 163,584 KB |
| 最終ジャッジ日時 | 2024-12-23 09:39:24 |
| 合計ジャッジ時間 | 24,268 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define replr(i,l,r) for (ll i=(ll)(l);i<(ll)(r);i++)
#define all(v) v.begin(),v.end()
#define len(v) ((ll)v.size())
template<class T> inline bool chmin(T &a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T &a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
#include<atcoder/modint>
using mint=atcoder::modint998244353;
mint dp[10002][2][2][1<<10];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
ll n=len(s);
dp[0][0][0][0]=1;
rep(i,n){
rep(j,2){
rep(k,2){
rep(l,1<<10){
rep(m,j==0?s[i]-'0'+1:10){
dp[i+1][j|(m<s[i]-'0')][k|(m!=0)][(k|(m!=0))?(l^(1<<m)):l]+=dp[i][j][k][l];
}
}
}
}
}
cout << (dp[n][0][1][0]+dp[n][1][1][0]).val() << '\n';
}
FplusFplusF