#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e5+10, mod=1e9+7;
int n, a[N], f[N][2];
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i=1; i<=n; ++i) cin >> a[i];
for (int i=1; i<=n; ++i){
sort(a+1, a+i+1);
f[1][0]=(a[1]+1)/2;
f[1][1]=f[1][0]-1;
for (int j=2; j<=i; ++j){
if ((a[j]&1)==(a[j-1]&1)){
f[j][0]=(f[j-1][0]*(a[j]-a[j-1])/2+f[j-1][1]+mod)%mod;
f[j][1]=(f[j][0]-f[j-1][0]+mod)%mod;
}else{
f[j][0]=f[j-1][0]*(a[j]-a[j-1]+1)/2%mod;
f[j][1]=(f[j][0]-f[j-1][0]+mod)%mod;
}
}
cout << f[i][0] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Execution timed out |
4035 ms |
3212 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |