Submission #918700

#TimeUsernameProblemLanguageResultExecution timeMemory
918700AbitoBinaria (CCO23_day1problem1)C++14
6 / 25
2 ms4696 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt #define int long long #define ll long long #define y1 YONE #define free freeee #define lcm llcm typedef unsigned long long ull; using namespace std; const int N=1e6+5,M=1e6+3; int a[N],n,k,b[N],p[N],ans; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n>>k; for (int i=1;i<=n-k+1;i++) cin>>b[i]; for (int mask=0;mask<(1<<n);mask++){ for (int i=1;i<=n;i++) a[i]=bool(mask&(1<<(i-1))),p[i]=p[i-1]+a[i]; bool ok=true; for (int i=k;i<=n;i++) ok&=(p[i]-p[i-k]==b[i-k+1]); ans+=ok; }cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...