# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1146761 | tnt | Snake Escaping (JOI18_snake_escaping) | C++20 | 0 ms | 0 KiB |
using namespace std;
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
#define pb push_back
#define ll long long
//#define sort(all(v)) sort(v.begin(),v.end())
int mod = 998244353;
const int N = 1e5 + 10;
const int inf = 1e9;
signed main(){
//freopen("mootube.in", "r", stdin);
//freopen("mootube.out", "w", stdout);
int l,q;
cin >> l >> q;
string s;
cin >> s;
vector <ll> dp((1 << l)),dp1((1 << l));
for(int i = 0; i < (1 << l); i++){
dp[i] = dp1[i] = s[i] - '0';
}
for(int i = 0; i < l; i++){
for(int mask = (1 << l) - 1; mask >= 0;mask--){
if(!(mask >> i & 1)){
dp1[mask] += dp1[(mask ^ (1 << i))];
}