Submission #54166572
Source Code Expand
Copy
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;using ui = unsigned;using ll = long long;using ull = unsigned long long;using ld = long double;#define rep(i,l,r) for(int i=(l);i<=(r);++i)#define per(i,l,r) for(int i=(l);i>=(r);--i)#define repn(i,n) for(int i=0;i<(n);++i)#define sizc(x) ((int)x.size())#define allc(x) x.begin(),x.end()#define fir first#define sec secondnamespace KnownError_{constexpr int N = 1e4+5, M = 10;using Z=atcoder::modint998244353;int m,n,x[M],ns[M];Z dp[N][1<<M];void main(){
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ui = unsigned; using ll = long long; using ull = unsigned long long; using ld = long double; #define rep(i,l,r) for(int i=(l);i<=(r);++i) #define per(i,l,r) for(int i=(l);i>=(r);--i) #define repn(i,n) for(int i=0;i<(n);++i) #define sizc(x) ((int)x.size()) #define allc(x) x.begin(),x.end() #define fir first #define sec second namespace KnownError_{ constexpr int N = 1e4+5, M = 10; using Z=atcoder::modint998244353; int m,n,x[M],ns[M]; Z dp[N][1<<M]; void main(){ cin>>m>>n; repn(i,m)cin>>x[i],--x[i],ns[x[i]]|=1<<i; dp[0][(1<<m)-1]=1; rep(i,1,n){ repn(j,m){ repn(S,1<<m)if(S>>j&1){ int T=S; T^=1<<j; T|=ns[j]; dp[i][T]+=dp[i-1][S]; } } } Z ans=0; repn(S,1<<m)ans+=dp[n][S]; cout<<ans.val()<<'\n'; } } signed main(){ // freopen(".in","r",stdin); // freopen(".out","w",stdout); ios::sync_with_stdio(false); cin.tie(nullptr); KnownError_::main(); }
Submission Info
Submission Time | |
---|---|
Task | B - Between B and B |
User | KnownError_ |
Language | C++ 20 (gcc 12.2) |
Score | 500 |
Code Size | 1234 Byte |
Status | AC |
Exec Time | 118 ms |
Memory | 43660 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt |
All | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt, 01-handmade-001.txt, 01-handmade-002.txt, 01-handmade-003.txt, 01-handmade-004.txt, 01-handmade-005.txt, 01-handmade-006.txt, 01-handmade-007.txt, 01-handmade-008.txt, 01-handmade-009.txt, 02-random-001.txt, 02-random-002.txt, 02-random-003.txt, 02-random-004.txt, 02-random-005.txt, 02-random-006.txt, 02-random-007.txt, 02-random-008.txt, 02-random-009.txt, 02-random-010.txt, 02-random-011.txt, 02-random-012.txt, 02-random-013.txt, 02-random-014.txt, 02-random-015.txt, 02-random-016.txt, 02-random-017.txt, 02-random-018.txt, 02-random-019.txt, 02-random-020.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00-sample-001.txt | AC | 17 ms | 43536 KB |
00-sample-002.txt | AC | 17 ms | 43488 KB |
00-sample-003.txt | AC | 17 ms | 43508 KB |
01-handmade-001.txt | AC | 16 ms | 43464 KB |
01-handmade-002.txt | AC | 17 ms | 43468 KB |
01-handmade-003.txt | AC | 114 ms | 43656 KB |
01-handmade-004.txt | AC | 117 ms | 43372 KB |
01-handmade-005.txt | AC | 115 ms | 43396 KB |
01-handmade-006.txt | AC | 118 ms | 43536 KB |
01-handmade-007.txt | AC | 115 ms | 43532 KB |
01-handmade-008.txt | AC | 115 ms | 43376 KB |
01-handmade-009.txt | AC | 16 ms | 43584 KB |
02-random-001.txt | AC | 16 ms | 43508 KB |
02-random-002.txt | AC | 16 ms | 43524 KB |
02-random-003.txt | AC | 16 ms | 43476 KB |
02-random-004.txt | AC | 16 ms | 43508 KB |
02-random-005.txt | AC | 16 ms | 43532 KB |
02-random-006.txt | AC | 16 ms | 43472 KB |
02-random-007.txt | AC | 16 ms | 43372 KB |
02-random-008.txt | AC | 18 ms | 43660 KB |
02-random-009.txt | AC | 16 ms | 43368 KB |
02-random-010.txt | AC | 16 ms | 43460 KB |
02-random-011.txt | AC | 17 ms | 43568 KB |
02-random-012.txt | AC | 16 ms | 43464 KB |
02-random-013.txt | AC | 52 ms | 43580 KB |
02-random-014.txt | AC | 26 ms | 43572 KB |
02-random-015.txt | AC | 16 ms | 43656 KB |
02-random-016.txt | AC | 26 ms | 43460 KB |
02-random-017.txt | AC | 17 ms | 43368 KB |
02-random-018.txt | AC | 17 ms | 43564 KB |
02-random-019.txt | AC | 17 ms | 43520 KB |
02-random-020.txt | AC | 16 ms | 43508 KB |