QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#5408 | #2020. 微信步数 | Qingyu✨ | 100 ✓ | 70ms | 5612kb | C++17 | 3.7kb | 2020-12-09 16:14:15 | 2021-12-19 06:16:49 |
Judging History
answer
#include <cstdio>
#include <algorithm>
#define K 12
#define N 500005
using std::min;
using std::max;
const int MOD = 1000000007, INF = 0x3f3f3f3f;
int n, k, w[K], c[N], d[N], dt[K], mn[K], mx[K], cmn[K], cmx[K], cs[K], pw[K], ans;
int tr[K][K], sum[K], tmp[K];
inline int mval(int x) {
return x >= MOD ? x - MOD : x;
}
inline void inc(int &x, int a) {
x = mval(x + a);
}
inline int qpow(int x, int p) {
int ret = 1;
while (p) {
if (p & 1)
ret = 1ll * ret * x % MOD;
p >>= 1, x = 1ll * x * x % MOD;
}
return ret;
}
inline void lag(int *f, int *g, int n) {
for (int i = 0; i <= n; ++i) {
std::fill(tmp, tmp + n + 1, 0);
tmp[0] = 1;
int cur = 1;
for (int j = 0; j <= n; ++j)
if (i != j) {
cur = 1ll * (MOD + i - j) * cur % MOD;
for (int k = n; k; --k)
tmp[k] = mval(MOD + tmp[k - 1] - 1ll * j * tmp[k] % MOD);
tmp[0] = mval(MOD - 1ll * tmp[0] * j % MOD);
}
cur = qpow(cur, MOD - 2);
for (int j = 0; j <= n; ++j)
inc(g[j], 1ll * f[i]*cur % MOD * tmp[j] % MOD);
}
}
inline void proc(int n) {
for (int i = 0; i <= n; ++i) {
for (int j = 1; j <= i + 1; ++j)
sum[j] = qpow(j, i);
for (int j = 1; j <= i + 1; ++j)
inc(sum[j], sum[j - 1]);
lag(sum, tr[i], i + 1);
}
}
inline void mul(int a, int b) {
for (int i = k; i; --i)
tmp[i] = mval(1ll * a * tmp[i - 1] % MOD + 1ll * b * tmp[i] % MOD);
tmp[0] = 1ll * tmp[0] * b % MOD;
}
int main() {
scanf("%d%d", &n, &k);
proc(10);
pw[0] = 1;
for (int i = 1; i <= k; ++i)
scanf("%d", w + i);
for (int i = 1; i <= n; ++i) {
scanf("%d%d", c + i, d + i);
int x = c[i];
dt[x] += d[i], mn[x] = std::min(mn[x], dt[x]), mx[x] = std::max(mx[x], dt[x]);
}
for (int i = 1; i <= n; ++i)
if (dt[c[i]] < 0)
d[i] = -d[i];
for (int i = 1; i <= k; ++i)
if (dt[i] < 0)
dt[i] = -dt[i], std::swap(mn[i], mx[i]), mn[i] = -mn[i], mx[i] = -mx[i];
bool ok = 1;
for (int i = 1; i <= k; ++i)
if (dt[i] || w[i] <= mx[i] - mn[i]) {
ok = 0;
break;
}
if (ok)
return puts("-1"), 0;
for (int i = 1; i <= n; ++i) {
int x = c[i];
cs[x] += d[i];
if (cmn[x] <= cs[x] && cs[x] <= cmx[x])
continue;
cmn[x] = min(cmn[x], cs[x]);
cmx[x] = max(cmx[x], cs[x]);
if (cmx[x] - cmn[x] > w[x])
break;
if (dt[x] != 0 && d[i] > 0 && cs[x] + dt[x] > mx[x]) {
int lim = (w[x] - max(mx[x] - dt[x], cmx[x]) + mn[x]) / dt[x];
std::fill(tmp, tmp + k + 2, 0);
tmp[0] = i, tmp[1] = n;
for (int t = 1; t <= k; ++t)
if (t != x) {
if (dt[t])
lim = min(lim, (w[t] - max(mx[t] - dt[t], cmx[t]) + mn[t] - 1) / dt[t]);
mul(mval(MOD - dt[t]), w[t] - max(mx[t] - dt[t], cmx[t]) + mn[t]);
}
for (int j = 1; j <= k + 1; ++j)
pw[j] = 1ll * pw[j - 1] * lim % MOD;
for (int a = 0; a <= k; ++a)
for (int b = 0; b <= a + 1; ++b)
inc(ans, 1ll * tmp[a]*tr[a][b] % MOD * pw[b] % MOD);
}
int cur = 1;
for (int t = 1; t <= k; ++t)
if (t != x)
cur = 1ll * cur * (w[t] - cmx[t] + cmn[t]) % MOD;
inc(ans, 1ll * i * cur % MOD);
}
printf("%d\n", ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 5
Accepted
time: 1ms
memory: 3708kb
input:
5 5 2 2 1 3 3 1 1 2 -1 1 1 5 -1 5 1
output:
63
result:
ok 1 number(s): "63"
Test #2:
score: 5
Accepted
time: 0ms
memory: 3760kb
input:
5 5 2 2 2 3 2 5 -1 5 1 2 1 2 1 5 1
output:
108
result:
ok 1 number(s): "108"
Test #3:
score: 5
Accepted
time: 1ms
memory: 3680kb
input:
5 5 3 3 1 3 2 4 1 4 -1 1 -1 3 -1 2 1
output:
150
result:
ok 1 number(s): "150"
Test #4:
score: 5
Accepted
time: 1ms
memory: 3600kb
input:
100 3 8 7 6 1 1 1 -1 3 1 3 -1 3 1 3 -1 3 1 3 -1 1 1 1 -1 1 1 1 -1 2 1 2 -1 1 1 1 -1 2 1 2 -1 3 1 3 -1 3 1 3 -1 3 1 3 -1 2 1 2 -1 3 1 3 -1 3 1 3 -1 1 1 1 -1 1 1 1 -1 3 1 3 -1 3 1 3 -1 1 1 1 -1 1 1 1 -1 2 1 2 -1 1 1 1 -1 2 1 2 -1 2 1 2 -1 2 1 2 -1 3 1 3 -1 1 1 1 -1 3 1 3 -1 3 1 3 -1 3 1 3 -1 3 1 3 -1 1 1 1 -1 3 1 3 -1 1 1 1 -1 2 1 2 -1 1 1 1 -1 1 1 1 -1 2 1 2 -1 2 1 2 -1 1 1 1 -1 3 1 3 -1 1 1 1 -1 2 1 2 -1 1 1 1 -1 3 1 3 -1 3 1 3 -1 3 1 3 -1 2 1 2 -1 3 1 3 -1
output:
-1
result:
ok 1 number(s): "-1"
Test #5:
score: 5
Accepted
time: 1ms
memory: 3672kb
input:
100 3 6 7 5 1 1 2 1 3 1 2 -1 2 -1 3 -1 3 -1 2 -1 3 1 2 -1 2 -1 2 1 1 -1 1 1 2 -1 2 -1 2 1 3 -1 3 -1 1 -1 2 1 3 -1 3 -1 1 -1 3 1 3 1 1 1 3 -1 1 1 1 1 1 -1 1 1 3 1 2 -1 2 1 2 1 1 -1 2 1 1 -1 2 1 3 -1 2 -1 1 -1 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 -1 1 -1 1 1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 -1 1 1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 1 -1 1 1 1 1 1 1 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:
333173136
result:
ok 1 number(s): "333173136"
Test #8:
score: 5
Accepted
time: 14ms
memory: 4088kb
input:
100000 1 74078 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 1 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:
453472675
result:
ok 1 number(s): "453472675"
Test #9:
score: 5
Accepted
time: 10ms
memory: 2408kb
input:
100000 2 788727 548098 1 -1 2 1 2 -1 2 1 1 -1 1 1 2 -1 2 -1 1 -1 2 1 2 -1 2 1 2 -1 1 -1 2 -1 2 1 1 -1 2 1 1 -1 1 -1 1 1 1 -1 1 -1 2 -1 1 1 1 -1 2 1 2 1 1 -1 1 1 1 -1 1 1 2 -1 2 -1 1 -1 2 -1 2 1 2 -1 2 -1 2 -1 1 -1 2 -1 2 1 2 1 1 1 1 1 2 1 1 -1 2 -1 2 1 1 -1 1 -1 1 -1 2 -1 1 1 1 -1 1 1 2 1 2 1 1 1 1 -1 1 -1 1 1 2 1 1 1 2 -1 1 1 1 1 2 -1 1 1 2 1 1 -1 2 -1 2 -1 1 -1 2 1 2 1 2 1 1 1 2 -1 2 -1 2 1 2 -1 2 -1 1 1 2 -1 2 -1 1 -1 2 -1 1 1 1 -1 2 1 2 1 1 -1 1 -1 2 -1 2 1 2 -1 2 -1 1 1 1 -1 2 -1 2 -1 1 -1 ...
output:
433871022
result:
ok 1 number(s): "433871022"
Test #10:
score: 5
Accepted
time: 14ms
memory: 4052kb
input:
100000 2 851838 526074 1 1 1 1 1 1 1 -1 2 -1 2 -1 1 1 2 1 2 1 2 1 2 1 1 1 1 -1 2 1 1 1 2 1 1 -1 2 -1 1 -1 2 1 2 1 2 -1 1 -1 2 -1 2 -1 2 -1 1 -1 2 -1 2 1 2 -1 2 1 2 -1 2 -1 2 1 2 1 2 -1 2 -1 1 -1 2 -1 1 -1 1 -1 1 -1 2 1 1 -1 1 1 2 -1 2 -1 1 1 2 1 2 -1 2 1 1 -1 2 -1 1 1 2 1 2 -1 1 -1 1 -1 1 1 2 -1 2 1 1 -1 2 1 1 1 1 1 2 -1 1 -1 2 -1 1 -1 2 1 1 -1 2 -1 2 1 1 -1 2 -1 2 -1 1 1 2 1 1 -1 2 -1 1 -1 1 1 2 -1 2 -1 2 -1 2 1 1 -1 2 1 1 1 2 1 2 1 2 -1 2 -1 1 -1 2 1 1 -1 1 -1 1 1 1 1 2 -1 2 1 2 -1 2 1 1 1 1 1...
output:
635878930
result:
ok 1 number(s): "635878930"
Test #11:
score: 5
Accepted
time: 14ms
memory: 4144kb
input:
100000 2 936902 869936 1 -1 1 -1 1 -1 2 -1 2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 number(s): "564885404"
Test #13:
score: 5
Accepted
time: 46ms
memory: 5492kb
input:
500000 10 755576 503368 607237 931815 889701 742191 594456 676526 704905 569952 9 1 9 -1 8 1 8 -1 4 1 4 -1 7 1 7 -1 3 1 3 -1 1 1 1 -1 6 1 6 -1 1 1 1 -1 10 1 10 -1 2 1 2 -1 1 1 1 -1 2 1 2 -1 5 1 5 -1 4 1 4 -1 3 1 3 -1 7 1 7 -1 3 1 3 -1 4 1 4 -1 6 1 6 -1 7 1 7 -1 4 1 4 -1 1 1 1 -1 2 1 2 -1 5 1 5 -1 6 1 6 -1 6 1 6 -1 3 1 3 -1 6 1 6 -1 5 1 5 -1 1 1 1 -1 10 1 10 -1 8 1 8 -1 8 1 8 -1 6 1 6 -1 3 1 3 -1 3 1 3 -1 3 1 3 -1 10 1 10 -1 1 1 1 -1 4 1 4 -1 6 1 6 -1 3 1 3 -1 1 1 1 -1 10 1 10 -1 4 1 4 -1 1 1 1 -...
output:
-1
result:
ok 1 number(s): "-1"
Test #14:
score: 5
Accepted
time: 62ms
memory: 5612kb
input:
500000 10 843479 559917 806296 766435 965493 781368 889933 632099 689781 934269 3 1 10 1 3 1 3 -1 6 1 7 -1 8 1 9 1 4 1 2 -1 5 1 2 -1 5 1 8 -1 4 -1 10 -1 8 -1 7 -1 1 -1 3 -1 5 1 6 1 3 -1 6 -1 3 1 10 -1 5 1 4 1 2 1 10 -1 5 -1 4 1 5 -1 4 -1 5 -1 4 1 3 -1 8 1 5 1 3 -1 1 -1 5 1 2 -1 8 1 5 1 9 -1 4 -1 10 -1 3 -1 3 -1 6 -1 4 1 6 1 4 1 10 1 4 -1 4 -1 3 -1 8 -1 7 1 4 -1 8 1 7 -1 6 -1 4 1 5 -1 8 -1 5 -1 2 -1 3 1 9 -1 5 -1 1 1 10 -1 4 -1 7 1 4 -1 9 -1 9 1 6 1 4 1 9 1 8 1 2 -1 8 1 4 1 7 -1 1 -1 10 -1 10 1 6...
output:
212475448
result:
ok 1 number(s): "212475448"
Test #15:
score: 5
Accepted
time: 70ms
memory: 5564kb
input:
500000 10 564550 662731 907937 653446 887637 552698 501487 502890 574491 689451 8 -1 2 1 2 -1 10 -1 5 -1 10 1 9 1 8 1 6 1 6 1 2 -1 2 -1 9 -1 1 -1 9 -1 7 -1 8 1 9 -1 9 1 9 -1 6 1 10 1 1 -1 8 -1 10 -1 10 1 7 1 4 1 6 1 1 -1 2 -1 2 1 5 -1 2 -1 7 1 5 -1 8 -1 5 1 7 -1 2 -1 3 1 9 1 3 -1 7 1 8 1 5 -1 1 1 6 1 2 -1 9 1 5 1 6 1 6 -1 4 -1 9 -1 4 -1 4 -1 9 1 6 -1 7 1 2 -1 2 -1 4 1 2 -1 9 -1 5 -1 2 1 10 -1 6 -1 3 -1 2 1 7 1 10 1 4 -1 5 1 1 1 5 -1 8 1 2 -1 10 1 1 -1 10 -1 8 -1 9 1 1 1 10 -1 1 1 4 1 10 1 4 -1 7...
output:
27023740
result:
ok 1 number(s): "27023740"
Test #16:
score: 5
Accepted
time: 60ms
memory: 5524kb
input:
500000 10 918488 957499 964399 900665 976079 674192 501308 980114 958902 545155 6 1 1 -1 1 1 9 1 1 1 5 -1 4 1 1 -1 9 -1 6 1 1 -1 6 1 10 1 5 -1 8 1 10 1 2 1 7 1 5 -1 6 -1 10 -1 1 -1 4 -1 6 -1 4 1 10 -1 10 -1 6 -1 4 -1 7 -1 4 1 6 1 6 -1 10 1 9 1 4 -1 4 1 3 -1 7 -1 1 -1 5 1 8 1 10 1 2 1 2 -1 2 1 3 1 6 1 2 -1 8 -1 7 -1 7 1 10 1 10 -1 5 1 3 -1 8 1 2 1 2 1 10 -1 10 1 8 1 4 -1 10 1 10 -1 4 -1 4 -1 7 -1 4 1 4 1 10 -1 8 1 1 -1 3 1 10 1 3 1 3 1 7 -1 8 1 6 1 9 1 9 1 4 1 4 -1 2 1 7 1 5 -1 2 1 1 1 4 1 3 -1 9...
output:
128050940
result:
ok 1 number(s): "128050940"
Test #17:
score: 5
Accepted
time: 67ms
memory: 5568kb
input:
500000 3 826619243 796070724 841056572 3 1 2 1 3 -1 1 -1 2 1 2 -1 1 -1 1 1 1 -1 3 1 1 -1 2 -1 3 -1 3 1 1 -1 1 1 3 -1 2 1 2 1 3 -1 2 1 2 1 1 -1 1 1 1 1 1 -1 2 1 3 -1 2 -1 2 1 3 1 1 1 1 -1 3 1 2 -1 1 -1 2 1 2 1 2 -1 3 -1 1 -1 1 -1 2 -1 3 -1 1 -1 3 -1 2 1 2 -1 3 1 1 -1 1 1 1 1 1 1 1 1 3 -1 1 1 3 1 2 1 2 1 3 1 2 -1 2 1 2 1 1 -1 2 1 1 -1 2 -1 3 -1 3 1 2 1 3 1 2 1 2 1 2 -1 1 -1 2 -1 3 1 1 1 2 1 3 1 2 -1 2 -1 2 -1 2 1 3 -1 2 1 1 1 3 1 1 -1 3 -1 1 1 3 1 1 1 2 -1 1 -1 1 -1 1 1 3 -1 1 -1 1 -1 3 -1 3 1 2 -...
output:
953829771
result:
ok 1 number(s): "953829771"
Test #18:
score: 5
Accepted
time: 61ms
memory: 5564kb
input:
500000 3 956491428 866109891 631435277 2 1 1 -1 1 -1 3 -1 3 1 2 -1 2 1 1 -1 2 1 2 -1 1 -1 2 1 2 1 2 -1 1 1 3 1 3 -1 1 -1 1 1 1 1 3 -1 2 -1 1 1 1 1 2 -1 2 1 2 -1 2 -1 2 1 3 1 1 -1 2 -1 1 -1 2 1 3 1 1 1 3 -1 1 -1 2 -1 3 1 2 1 3 1 3 1 2 1 3 -1 1 -1 3 -1 2 1 1 1 2 1 3 -1 3 1 1 -1 3 -1 1 1 2 -1 2 -1 2 1 2 -1 1 -1 2 -1 2 1 3 1 1 1 3 -1 2 1 3 -1 1 1 2 1 2 1 1 1 3 1 1 1 3 1 2 1 3 -1 3 1 2 -1 3 -1 1 -1 3 1 2 -1 1 -1 3 1 2 -1 1 1 2 1 2 -1 3 -1 2 -1 2 1 1 -1 3 -1 3 1 1 1 1 1 3 1 3 -1 2 1 3 1 2 -1 3 -1 2 -1...
output:
286394049
result:
ok 1 number(s): "286394049"
Test #19:
score: 5
Accepted
time: 61ms
memory: 5528kb
input:
500000 3 816766322 779617142 794227651 3 1 2 1 1 1 3 -1 2 1 2 -1 1 1 1 1 1 1 3 -1 1 -1 2 1 3 1 1 -1 1 -1 1 1 3 1 3 1 1 -1 3 -1 2 1 1 -1 2 1 3 1 1 1 2 -1 3 -1 2 -1 1 -1 3 -1 1 1 3 -1 3 1 1 -1 3 1 2 -1 2 -1 1 -1 3 1 3 1 2 -1 3 1 3 -1 1 1 1 -1 3 1 1 1 2 1 2 1 1 1 2 1 1 -1 2 1 2 -1 2 1 3 -1 3 1 1 1 3 -1 1 1 1 -1 1 1 3 -1 3 1 3 -1 3 -1 1 -1 3 -1 2 -1 2 1 3 1 1 1 3 -1 1 1 3 -1 3 1 1 1 1 -1 2 1 1 -1 3 -1 2 1 3 -1 3 1 2 -1 1 -1 3 -1 2 1 1 1 2 1 3 -1 1 -1 2 -1 1 1 2 -1 3 1 2 -1 2 1 2 1 3 -1 3 1 2 1 1 1 3...
output:
950925221
result:
ok 1 number(s): "950925221"
Test #20:
score: 5
Accepted
time: 59ms
memory: 5540kb
input:
500000 3 600925621 781710332 540983402 1 -1 1 1 2 1 3 1 1 1 1 1 3 1 3 1 2 -1 3 -1 3 1 1 -1 1 1 2 -1 1 -1 1 -1 3 -1 2 1 1 1 1 -1 1 -1 1 1 3 -1 2 -1 2 -1 3 1 1 1 1 -1 3 1 2 1 1 -1 2 1 1 -1 3 -1 3 -1 2 -1 3 -1 2 1 3 -1 1 1 2 1 2 1 3 -1 2 1 1 1 1 1 3 1 2 -1 1 1 3 1 2 -1 3 -1 3 1 2 -1 3 -1 1 1 1 1 1 -1 3 1 1 1 2 -1 2 -1 2 -1 1 -1 2 1 1 -1 1 -1 1 -1 2 1 3 -1 3 1 1 -1 1 1 1 -1 3 1 3 1 1 1 2 -1 2 1 3 -1 1 -1 1 -1 3 1 2 -1 1 -1 2 1 3 -1 3 1 1 -1 1 1 3 1 2 1 1 1 1 1 2 1 3 -1 3 -1 3 -1 2 -1 2 1 1 1 2 -1 3 ...
output:
370329204
result:
ok 1 number(s): "370329204"
Extra Test:
score: 0
Extra Test Passed