//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 ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2904 KB |
Output is correct |
2 |
Correct |
1 ms |
2908 KB |
Output is correct |
3 |
Correct |
1 ms |
2908 KB |
Output is correct |
4 |
Correct |
1 ms |
2908 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
1 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
3020 KB |
Output is correct |
9 |
Correct |
1 ms |
2904 KB |
Output is correct |
10 |
Correct |
1 ms |
2904 KB |
Output is correct |
11 |
Correct |
1 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2904 KB |
Output is correct |
2 |
Correct |
1 ms |
2908 KB |
Output is correct |
3 |
Correct |
1 ms |
2908 KB |
Output is correct |
4 |
Correct |
1 ms |
2908 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
1 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
3020 KB |
Output is correct |
9 |
Correct |
1 ms |
2904 KB |
Output is correct |
10 |
Correct |
1 ms |
2904 KB |
Output is correct |
11 |
Correct |
1 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
13 |
Correct |
1 ms |
2908 KB |
Output is correct |
14 |
Correct |
1 ms |
2908 KB |
Output is correct |
15 |
Correct |
1 ms |
2908 KB |
Output is correct |
16 |
Correct |
1 ms |
2908 KB |
Output is correct |
17 |
Correct |
1 ms |
2908 KB |
Output is correct |
18 |
Correct |
1 ms |
2912 KB |
Output is correct |
19 |
Correct |
1 ms |
2912 KB |
Output is correct |
20 |
Correct |
1 ms |
2920 KB |
Output is correct |
21 |
Correct |
2 ms |
3028 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2904 KB |
Output is correct |
2 |
Correct |
1 ms |
2908 KB |
Output is correct |
3 |
Correct |
1 ms |
2908 KB |
Output is correct |
4 |
Correct |
1 ms |
2908 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
1 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
3020 KB |
Output is correct |
9 |
Correct |
1 ms |
2904 KB |
Output is correct |
10 |
Correct |
1 ms |
2904 KB |
Output is correct |
11 |
Correct |
1 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
13 |
Correct |
1 ms |
2908 KB |
Output is correct |
14 |
Correct |
1 ms |
2908 KB |
Output is correct |
15 |
Correct |
1 ms |
2908 KB |
Output is correct |
16 |
Correct |
1 ms |
2908 KB |
Output is correct |
17 |
Correct |
1 ms |
2908 KB |
Output is correct |
18 |
Correct |
1 ms |
2912 KB |
Output is correct |
19 |
Correct |
1 ms |
2912 KB |
Output is correct |
20 |
Correct |
1 ms |
2920 KB |
Output is correct |
21 |
Correct |
2 ms |
3028 KB |
Output is correct |
22 |
Incorrect |
1 ms |
2912 KB |
Output isn't correct |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2904 KB |
Output is correct |
2 |
Correct |
1 ms |
2908 KB |
Output is correct |
3 |
Correct |
1 ms |
2908 KB |
Output is correct |
4 |
Correct |
1 ms |
2908 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
1 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
3020 KB |
Output is correct |
9 |
Correct |
1 ms |
2904 KB |
Output is correct |
10 |
Correct |
1 ms |
2904 KB |
Output is correct |
11 |
Correct |
1 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
13 |
Correct |
1 ms |
2908 KB |
Output is correct |
14 |
Correct |
1 ms |
2908 KB |
Output is correct |
15 |
Correct |
1 ms |
2908 KB |
Output is correct |
16 |
Correct |
1 ms |
2908 KB |
Output is correct |
17 |
Correct |
1 ms |
2908 KB |
Output is correct |
18 |
Correct |
1 ms |
2912 KB |
Output is correct |
19 |
Correct |
1 ms |
2912 KB |
Output is correct |
20 |
Correct |
1 ms |
2920 KB |
Output is correct |
21 |
Correct |
2 ms |
3028 KB |
Output is correct |
22 |
Incorrect |
1 ms |
2912 KB |
Output isn't correct |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2904 KB |
Output is correct |
2 |
Correct |
1 ms |
2908 KB |
Output is correct |
3 |
Correct |
1 ms |
2908 KB |
Output is correct |
4 |
Correct |
1 ms |
2908 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
1 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
3020 KB |
Output is correct |
9 |
Correct |
1 ms |
2904 KB |
Output is correct |
10 |
Correct |
1 ms |
2904 KB |
Output is correct |
11 |
Correct |
1 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
13 |
Correct |
1 ms |
2908 KB |
Output is correct |
14 |
Correct |
1 ms |
2908 KB |
Output is correct |
15 |
Correct |
1 ms |
2908 KB |
Output is correct |
16 |
Correct |
1 ms |
2908 KB |
Output is correct |
17 |
Correct |
1 ms |
2908 KB |
Output is correct |
18 |
Correct |
1 ms |
2912 KB |
Output is correct |
19 |
Correct |
1 ms |
2912 KB |
Output is correct |
20 |
Correct |
1 ms |
2920 KB |
Output is correct |
21 |
Correct |
2 ms |
3028 KB |
Output is correct |
22 |
Incorrect |
1 ms |
2912 KB |
Output isn't correct |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2904 KB |
Output is correct |
2 |
Correct |
1 ms |
2908 KB |
Output is correct |
3 |
Correct |
1 ms |
2908 KB |
Output is correct |
4 |
Correct |
1 ms |
2908 KB |
Output is correct |
5 |
Correct |
1 ms |
2904 KB |
Output is correct |
6 |
Correct |
1 ms |
2908 KB |
Output is correct |
7 |
Correct |
1 ms |
2908 KB |
Output is correct |
8 |
Correct |
1 ms |
3020 KB |
Output is correct |
9 |
Correct |
1 ms |
2904 KB |
Output is correct |
10 |
Correct |
1 ms |
2904 KB |
Output is correct |
11 |
Correct |
1 ms |
2904 KB |
Output is correct |
12 |
Correct |
1 ms |
2908 KB |
Output is correct |
13 |
Correct |
1 ms |
2908 KB |
Output is correct |
14 |
Correct |
1 ms |
2908 KB |
Output is correct |
15 |
Correct |
1 ms |
2908 KB |
Output is correct |
16 |
Correct |
1 ms |
2908 KB |
Output is correct |
17 |
Correct |
1 ms |
2908 KB |
Output is correct |
18 |
Correct |
1 ms |
2912 KB |
Output is correct |
19 |
Correct |
1 ms |
2912 KB |
Output is correct |
20 |
Correct |
1 ms |
2920 KB |
Output is correct |
21 |
Correct |
2 ms |
3028 KB |
Output is correct |
22 |
Incorrect |
1 ms |
2912 KB |
Output isn't correct |
23 |
Halted |
0 ms |
0 KB |
- |