QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#614079 | #1882. Drunkards | wxy2010 | AC ✓ | 80ms | 74428kb | C++14 | 2.2kb | 2024-10-05 15:33:28 | 2024-10-05 15:33:31 |
Judging History
answer
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define _GLIBCXX_DEBUG_PEDANTIC
#endif
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
#define min(args...) min({args})
#define max(args...) max({args})
#define redirect(filename) freopen(#filename".in", "r", stdin), freopen(#filename".out", "w", stdout)
#define all(container) container.begin(), container.end()
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define pb push_back
#define eb emplace_back
#ifdef DEBUG
#define debug() fprintf(stderr, "%d\n", __LINE__)
#define debugf(fmt, args...) fprintf(stderr, fmt, ## args)
#define debuglf(fmt, args...) fprintf(stderr, "%d: " fmt "\n", __LINE__, ## args)
#else
#define debug()
#define debugf(...)
#define debuglf(...)
#endif
template<typename t> class gpq : public priority_queue<t, vector<t>, greater<t>> {};
typedef int64_t ll;
typedef uint64_t ull;
typedef __int128 lll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
const bool MULTIPLE_TESTS = 0;
const int mod=998244353,inv100=828542813;
int n,p,p2;
int a[5005];
int f[5005][10010];
inline void add(int& x,const ll& y){x=(x+y)%mod;}
int qpow(int x,int y){
int ans=1;
while(y){
if(y&1)ans=(ll)ans*x%mod;
x=(ll)x*x%mod,y>>=1;
}
return ans;
}
void solve(int _Tid) {
static_assert(100ll*inv100%mod==1);
cin>>n>>p;p=(ll)p*inv100%mod,p2=(mod+1-p)%mod;
for(int i=1;i<=n;i++)cin>>a[i];
f[n+1][n]=1;
for(int i=n;i;i--){
for(int j=-n;j<=n;j++)if(f[i+1][j+n]){
add(f[i][j+n],(ll)f[i+1][j+n]*p);
add(f[i][j+n+a[i]],(ll)f[i+1][j+n]*p2);
}
f[i][n]=1;
}
int ans=0;
for(int i=-n;i<=n;i++)add(ans,f[1][n+i]);
ans=(ll)ans*qpow(n*2+1,mod-2)%mod;
cout<<ans<<'\n';
}
signed main() {
#ifndef DEBUG
fastio;
#endif
#ifdef DEBUG
auto _Tbe = chrono::steady_clock::now();
#endif
int T = 1;
if (MULTIPLE_TESTS) cin >> T;
for (int _ = 1; _ <= T; _++) solve(_);
#ifdef DEBUG
auto _Ted = chrono::steady_clock::now();
debugf("Used time: %lldms\n", chrono::duration_cast<chrono::milliseconds>(_Ted - _Tbe).count());
#endif
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
2 28 1 1
output:
702764025
result:
ok 1 number(s): "702764025"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
5 50 -1 1 -1 -1 -1
output:
17015529
result:
ok 1 number(s): "17015529"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
5 50 -1 1 -1 1 1
output:
680621150
result:
ok 1 number(s): "680621150"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
10 50 1 1 1 1 1 -1 -1 -1 1 1
output:
812744705
result:
ok 1 number(s): "812744705"
Test #5:
score: 0
Accepted
time: 1ms
memory: 5732kb
input:
10 50 -1 -1 1 1 -1 -1 1 -1 -1 -1
output:
158575275
result:
ok 1 number(s): "158575275"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
15 65 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 -1 1
output:
553313087
result:
ok 1 number(s): "553313087"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
15 65 -1 -1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1
output:
140408188
result:
ok 1 number(s): "140408188"
Test #8:
score: 0
Accepted
time: 1ms
memory: 5724kb
input:
10 7 1 1 1 1 1 1 1 1 1 1
output:
375530019
result:
ok 1 number(s): "375530019"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
10 73 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
output:
289966217
result:
ok 1 number(s): "289966217"
Test #10:
score: 0
Accepted
time: 1ms
memory: 5692kb
input:
10 0 1 1 -1 1 1 1 -1 1 -1 1
output:
95070891
result:
ok 1 number(s): "95070891"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
10 0 1 1 1 -1 1 1 1 1 1 1
output:
570425345
result:
ok 1 number(s): "570425345"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
10 0 -1 1 1 1 -1 1 -1 -1 1 1
output:
475354454
result:
ok 1 number(s): "475354454"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
10 0 -1 -1 -1 -1 -1 -1 1 -1 1 -1
output:
332748118
result:
ok 1 number(s): "332748118"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
10 0 1 1 1 1 1 1 -1 1 1 1
output:
570425345
result:
ok 1 number(s): "570425345"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
10 0 -1 -1 -1 1 1 1 -1 1 -1 1
output:
475354454
result:
ok 1 number(s): "475354454"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
10 0 -1 1 1 1 1 -1 -1 1 -1 1
output:
95070891
result:
ok 1 number(s): "95070891"
Test #17:
score: 0
Accepted
time: 1ms
memory: 5740kb
input:
10 100 -1 1 -1 1 1 -1 -1 -1 -1 -1
output:
617960790
result:
ok 1 number(s): "617960790"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
10 100 1 1 1 1 1 1 -1 1 1 1
output:
617960790
result:
ok 1 number(s): "617960790"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
10 100 -1 -1 -1 -1 1 1 -1 -1 1 1
output:
617960790
result:
ok 1 number(s): "617960790"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
10 27 1 -1 -1 1 -1 -1 1 -1 -1 1
output:
89502877
result:
ok 1 number(s): "89502877"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
10 27 1 1 -1 1 -1 1 1 -1 -1 1
output:
602378374
result:
ok 1 number(s): "602378374"
Test #22:
score: 0
Accepted
time: 59ms
memory: 72500kb
input:
5000 25 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 1 1 -1 1 -1 1 1 1 1 1 1 1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 1 1 1 -1 -1 1 1 -1 -1 1 1 1 -1 1 1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 ...
output:
961556565
result:
ok 1 number(s): "961556565"
Test #23:
score: 0
Accepted
time: 73ms
memory: 72556kb
input:
5000 25 1 -1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 1 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 1 -1 1 1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 ...
output:
234465387
result:
ok 1 number(s): "234465387"
Test #24:
score: 0
Accepted
time: 56ms
memory: 72496kb
input:
5000 25 -1 -1 1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1 1 -1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 1 1 1 1 -1 -1 1 1 1 1...
output:
836059165
result:
ok 1 number(s): "836059165"
Test #25:
score: 0
Accepted
time: 55ms
memory: 72500kb
input:
5000 25 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 -1 1 1 -1 1 1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 1 1...
output:
747198137
result:
ok 1 number(s): "747198137"
Test #26:
score: 0
Accepted
time: 73ms
memory: 72568kb
input:
5000 25 1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 1 ...
output:
915679440
result:
ok 1 number(s): "915679440"
Test #27:
score: 0
Accepted
time: 57ms
memory: 72508kb
input:
5000 25 -1 1 1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 ...
output:
129598521
result:
ok 1 number(s): "129598521"
Test #28:
score: 0
Accepted
time: 70ms
memory: 72592kb
input:
5000 25 -1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 1 1 1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 1 1 1 -1 -1 -1 -1 1 1 1...
output:
678292635
result:
ok 1 number(s): "678292635"
Test #29:
score: 0
Accepted
time: 68ms
memory: 72572kb
input:
5000 25 -1 -1 -1 1 -1 1 1 1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 1 -1 1 1 -1 -1 -1 1 1 1 -1 1 -1 1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -...
output:
570879180
result:
ok 1 number(s): "570879180"
Test #30:
score: 0
Accepted
time: 54ms
memory: 72528kb
input:
5000 25 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1...
output:
497284899
result:
ok 1 number(s): "497284899"
Test #31:
score: 0
Accepted
time: 65ms
memory: 72448kb
input:
5000 25 1 -1 -1 -1 1 1 -1 1 -1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 1 -1 1 -1 1 1 -1 -1 1 1 -1 1 1 -1 1 1 -1 1 -1 1 1 -1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 ...
output:
547200460
result:
ok 1 number(s): "547200460"
Test #32:
score: 0
Accepted
time: 66ms
memory: 74288kb
input:
5000 25 -1 1 -1 1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 1 1 1 ...
output:
431564537
result:
ok 1 number(s): "431564537"
Test #33:
score: 0
Accepted
time: 47ms
memory: 74300kb
input:
5000 25 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 1...
output:
944967577
result:
ok 1 number(s): "944967577"
Test #34:
score: 0
Accepted
time: 64ms
memory: 74428kb
input:
5000 25 -1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 1 -1 1 -1 -1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 1 -1 1...
output:
205819355
result:
ok 1 number(s): "205819355"
Test #35:
score: 0
Accepted
time: 46ms
memory: 72552kb
input:
5000 25 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1...
output:
307666691
result:
ok 1 number(s): "307666691"
Test #36:
score: 0
Accepted
time: 65ms
memory: 72592kb
input:
5000 25 1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 -1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 ...
output:
975555440
result:
ok 1 number(s): "975555440"
Test #37:
score: 0
Accepted
time: 71ms
memory: 72476kb
input:
5000 25 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 -1 -...
output:
954115106
result:
ok 1 number(s): "954115106"
Test #38:
score: 0
Accepted
time: 44ms
memory: 72532kb
input:
5000 25 1 1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 1 -1 1 -...
output:
20240102
result:
ok 1 number(s): "20240102"
Test #39:
score: 0
Accepted
time: 75ms
memory: 72548kb
input:
5000 25 -1 1 1 -1 1 -1 1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 -1 1 1 1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 -1 1 1 -1 1 1 1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 1 -1 1 1 -1 ...
output:
888096663
result:
ok 1 number(s): "888096663"
Test #40:
score: 0
Accepted
time: 65ms
memory: 72572kb
input:
5000 25 -1 1 1 1 1 1 1 1 -1 1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 1 1 1 -1 -1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 -1 1 1 -1 1 1 1 1 -1 1 1 1 1 1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 -1 -1 1 ...
output:
753978167
result:
ok 1 number(s): "753978167"
Test #41:
score: 0
Accepted
time: 66ms
memory: 72572kb
input:
5000 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
377962368
result:
ok 1 number(s): "377962368"
Test #42:
score: 0
Accepted
time: 63ms
memory: 72576kb
input:
5000 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 -1 1 1 -1 1 1 1 1...
output:
262524907
result:
ok 1 number(s): "262524907"
Test #43:
score: 0
Accepted
time: 73ms
memory: 72448kb
input:
5000 45 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 -1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 -1 1 1 1 1 ...
output:
684504852
result:
ok 1 number(s): "684504852"
Test #44:
score: 0
Accepted
time: 80ms
memory: 72580kb
input:
5000 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 ...
output:
256186185
result:
ok 1 number(s): "256186185"
Test #45:
score: 0
Accepted
time: 59ms
memory: 72528kb
input:
5000 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
56452003
result:
ok 1 number(s): "56452003"
Test #46:
score: 0
Accepted
time: 64ms
memory: 72480kb
input:
5000 45 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
353171752
result:
ok 1 number(s): "353171752"
Test #47:
score: 0
Accepted
time: 70ms
memory: 72504kb
input:
5000 45 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -...
output:
494279764
result:
ok 1 number(s): "494279764"
Test #48:
score: 0
Accepted
time: 64ms
memory: 72532kb
input:
5000 45 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
863796400
result:
ok 1 number(s): "863796400"
Test #49:
score: 0
Accepted
time: 61ms
memory: 72552kb
input:
5000 45 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
883427667
result:
ok 1 number(s): "883427667"
Test #50:
score: 0
Accepted
time: 52ms
memory: 72504kb
input:
5000 45 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 ...
output:
435945626
result:
ok 1 number(s): "435945626"
Test #51:
score: 0
Accepted
time: 67ms
memory: 72540kb
input:
5000 64 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
144231886
result:
ok 1 number(s): "144231886"
Test #52:
score: 0
Accepted
time: 69ms
memory: 72436kb
input:
5000 43 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
448366527
result:
ok 1 number(s): "448366527"
Test #53:
score: 0
Accepted
time: 28ms
memory: 26068kb
input:
5000 0 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 1 1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 ...
output:
961512634
result:
ok 1 number(s): "961512634"
Test #54:
score: 0
Accepted
time: 31ms
memory: 25356kb
input:
5000 0 -1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 -1 1 -1 -1 1 1 1 -1 1...
output:
356936487
result:
ok 1 number(s): "356936487"
Test #55:
score: 0
Accepted
time: 26ms
memory: 24872kb
input:
5000 0 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 1 1 ...
output:
973390554
result:
ok 1 number(s): "973390554"
Test #56:
score: 0
Accepted
time: 37ms
memory: 25596kb
input:
5000 100 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 -1 -1 ...
output:
906315241
result:
ok 1 number(s): "906315241"
Test #57:
score: 0
Accepted
time: 30ms
memory: 23704kb
input:
5000 100 1 1 1 1 -1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 1 1 1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 1 -1 -1 1 -1 1 1 1 1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 ...
output:
906315241
result:
ok 1 number(s): "906315241"
Test #58:
score: 0
Accepted
time: 28ms
memory: 23756kb
input:
5000 100 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1...
output:
906315241
result:
ok 1 number(s): "906315241"
Test #59:
score: 0
Accepted
time: 41ms
memory: 23712kb
input:
5000 100 -1 1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -...
output:
906315241
result:
ok 1 number(s): "906315241"
Test #60:
score: 0
Accepted
time: 22ms
memory: 23768kb
input:
5000 100 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 -1 1 ...
output:
906315241
result:
ok 1 number(s): "906315241"
Test #61:
score: 0
Accepted
time: 51ms
memory: 72408kb
input:
4998 5 -1 1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 1 1 1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 1 1 -1 1...
output:
335960136
result:
ok 1 number(s): "335960136"
Test #62:
score: 0
Accepted
time: 69ms
memory: 72432kb
input:
4998 5 1 1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 ...
output:
931188852
result:
ok 1 number(s): "931188852"
Test #63:
score: 0
Accepted
time: 39ms
memory: 72520kb
input:
4998 5 1 -1 1 1 -1 1 1 1 -1 1 1 1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 1 1 -1 1 1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1...
output:
747827219
result:
ok 1 number(s): "747827219"
Test #64:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
1 9 -1
output:
176356503
result:
ok 1 number(s): "176356503"
Test #65:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
2 69 -1 1
output:
857232356
result:
ok 1 number(s): "857232356"
Test #66:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
3 63 -1 -1 1
output:
296264521
result:
ok 1 number(s): "296264521"