QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#296501 | #6625. Binaria | 1437vszombies | 0 | 0ms | 3800kb | C++14 | 901b | 2024-01-03 08:11:12 | 2024-01-03 08:11:13 |
answer
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<cstdlib>
using namespace std;
const int maxn=1000005;
const int mod=1000003;
int n,k,p[maxn],ans=1,jc[maxn]={1},inv[maxn]={1};
int power(int x,int y){
int res=1;
for(;y;y>>=1,x=(long long)x*x%mod)if(y&1)res=(long long)res*x%mod;
return res;
}
int C(int x,int y){
return (long long)jc[x]*inv[y]%mod*inv[x-y]%mod;
}
signed main(){
ios::sync_with_stdio(false);cin.tie(0);
cin>>n>>k;
for(int i=1;i<=n-k+1;++i)cin>>p[i];
int zy=0,zl=p[1];
for(int i=1;i<=k;++i){
int flag=-1;
for(int j=i;j<n-k-1;j+=k){
int x=p[j+1]-p[j];
if(flag==-1){
if(x==-1)flag=1;
else if(x==1)flag=0;
}
}
if(flag==-1)++zy;
else zl-=flag;
}
for(int i=1;i<=n;++i){
jc[i]=(long long)jc[i-1]*i%mod;
inv[i]=power(jc[i],mod-2);
}
cout<<C(zy,zl);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 3
Accepted
time: 0ms
memory: 3660kb
input:
1 1 0
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
10 3 1 2 2 2 2 2 2 2
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
10 3 1 1 0 1 2 3 2 2
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
10 3 2 2 2 2 2 2 2 2
output:
3
result:
ok 1 number(s): "3"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
10 3 2 1 1 1 1 2 2 3
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
10 3 1 1 1 0 0 0 0 0
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
10 3 0 0 0 0 0 0 0 0
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
10 2 1 1 1 1 1 1 1 1 1
output:
2
result:
ok 1 number(s): "2"
Test #10:
score: -3
Wrong Answer
time: 0ms
memory: 3800kb
input:
10 2 1 1 1 1 1 1 1 1 2
output:
2
result:
wrong answer 1st numbers differ - expected: '1', found: '2'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #5:
0%