QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#630119 | #8527. Power Divisions | Corycle# | WA | 5ms | 22120kb | C++14 | 693b | 2024-10-11 16:34:09 | 2024-10-11 16:34:15 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int Mod=1e9+7;
const int N=3e5+5;
int read(){
int s=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}
return s*f;
}
int n,a[N],f[N];
unordered_map<int,int>pos[N];
int main(){
n=read();
f[0]=1;
for(int i=1;i<=n;i++){
a[i]=read();
int num=a[i];
pos[i][a[i]]=i;
for(int j=i;j>=1;){
f[i]=(f[i]+f[j-1])%Mod;
pos[i][num+1]=pos[j-1][num];
j=pos[j-1][num];
num++;
}
}
printf("%d\n",f[n]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 22120kb
input:
5 2 0 0 1 1
output:
6
result:
ok 1 number(s): "6"
Test #2:
score: 0
Accepted
time: 3ms
memory: 21256kb
input:
1 0
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 22064kb
input:
2 1 1
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 0ms
memory: 22060kb
input:
3 2 1 1
output:
3
result:
ok 1 number(s): "3"
Test #5:
score: 0
Accepted
time: 2ms
memory: 21092kb
input:
4 3 2 2 3
output:
4
result:
ok 1 number(s): "4"
Test #6:
score: 0
Accepted
time: 5ms
memory: 21872kb
input:
5 3 4 4 2 4
output:
2
result:
ok 1 number(s): "2"
Test #7:
score: -100
Wrong Answer
time: 4ms
memory: 20840kb
input:
7 3 4 3 5 6 3 4
output:
1
result:
wrong answer 1st numbers differ - expected: '6', found: '1'