This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//IOI - EGOI - OII 2024
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define ff first
#define ss second
using namespace std;
const int MAX=1e5+5;
vector<int>v[MAX];
int vis[MAX];
void go(){
int n,k,ans=0;
cin>>n>>k;
vector<int>v,v1;
for(int i=0;i<=n-k;i++){
int x; cin>>x;
v.push_back(x);
}
for(int i=0;i<(1<<n);i++){
int sum=0;
for(int j=0;j<k;j++){
int a=(1<<j)&i;
if(a>0) sum++;
}
v1.clear();
for(int j=0;j<=n-k;j++){
v1.push_back(sum);
if(j==n-k) continue;
if( ((1<<(j+k))&i)>0 ) sum++;
if( ((1<<j)&i)>0 ) sum--;
}
if(v1==v) ans++;
}
cout<<ans<<endl;
}
int main(){
fastio;
go();
return 0 ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |