結果
| 問題 | No.2772 Appearing Even Times |
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2024-05-31 23:14:33 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 4,000 ms |
| コード長 | 1,510 bytes |
| 記録 | |
| コンパイル時間 | 2,958 ms |
| コンパイル使用メモリ | 277,184 KB |
| 実行使用メモリ | 11,960 KB |
| 最終ジャッジ日時 | 2026-07-04 20:08:37 |
| 合計ジャッジ時間 | 5,146 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/vector:67,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/functional:66,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:55,
from main.cpp:1:
In function '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = atcoder::static_modint<998244353>*; _ForwardIterator = atcoder::static_modint<998244353>*]',
inlined from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _Sentinel, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = atcoder::static_modint<998244353>*; _Sentinel = atcoder::static_modint<998244353>*; _ForwardIterator = atcoder::static_modint<998244353>*; _Tp = atcoder::static_modint<998244353>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_uninitialized.h:637:37,
inlined from 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = atcoder::static_modint<998244353>; _Alloc = std::allocator<atcoder::static_modint<998244353> >]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/vector.tcc:257:35,
inlined from 'int main()' at main.cpp:82:8:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_uninitialized.h:273:31: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing between 1 and 4096 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
273 | __builtin_memcpy(std::__niter_base(__result),
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
274 | std::__niter_base(__first),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
275 | __n * sizeof(_ValT));
|
ソースコード
#include<bits/stdc++.h>
using namespace std;
//* ATCODER
#include<atcoder/all>
using namespace atcoder;
typedef modint998244353 mint;
//*/
/* BOOST MULTIPRECISION
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
//*/
typedef long long ll;
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)
template <typename T> bool chmin(T &a, const T &b) {
if (a <= b) return false;
a = b;
return true;
}
template <typename T> bool chmax(T &a, const T &b) {
if (a >= b) return false;
a = b;
return true;
}
template <typename T> T max(vector<T> &a){
assert(!a.empty());
T ret = a[0];
for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]);
return ret;
}
template <typename T> T min(vector<T> &a){
assert(!a.empty());
T ret = a[0];
for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]);
return ret;
}
template <typename T> T sum(vector<T> &a){
T ret = 0;
for (int i=0; i<(int)a.size(); i++) ret += a[i];
return ret;
}
int main(){
string n; cin >> n;
vector<int> a;
rep(i,0,(int)n.size()){
a.push_back(n[i] - '0');
}
vector<mint> dp(1024);
int tmp = 0;
rep(num,0,(int)n.size()){
vector<mint> ndp(1024);
rep(i,0,1024){
rep(j,0,10){
ndp[i^(1<<j)] += dp[i];
}
}
if (num > 0){
rep(i,1,10){
ndp[1<<i] += 1;
}
}
rep(i,num<1,a[num]){
ndp[tmp^(1<<i)] += 1;
}
tmp ^= 1 << a[num];
dp = ndp;
}
dp[tmp] += 1;
cout << dp[0].val() << '\n';
}
shobonvip