QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#538030 | #4564. Digital Circuit | Octagons# | 18 | 1148ms | 6424kb | C++20 | 2.2kb | 2024-08-30 21:12:10 | 2024-08-30 21:12:11 |
Judging History
answer
#include <bits/stdc++.h>
//#include "stub.cpp"
#include "circuit.h"
using namespace std;
typedef long long ll;
const int NN = 1e5+5, mod = 1000002022;
int n, m, dp[NN], tot[NN], dp2[NN], contrib[NN], tmp[NN];
vector<int> adj[NN];
int ad(int x, int y) {
x += y;
return (x >= mod ? x - mod : x);
}
int sub(int x, int y) {
x -= y;
return (x < 0 ? x + mod : x);
}
int mul(ll x, ll y) {
return (x * y) % mod;
}
void init_tot(int u) {
for (auto &v : adj[u]) {
init_tot(v);
tot[u] = mul(tot[u], tot[v]);
}
}
int on(int u) {
return dp[u];
}
int zer(int u) {
return sub(tot[u], dp[u]);
}
void calc(int u) {
if (adj[u].empty())return;
for (int i = 1; i <= adj[u].size(); i++) {
dp2[i] = 0;
}
dp2[0] = 1;
int ctr = 1;
for (auto &v : adj[u]) {
int zerr = zer(v), onn = on(v);
for (int j = ctr; j >= 1; j--) {
dp2[j] = ad(mul(dp2[j], zerr), mul(dp2[j-1], onn));
}
ctr++;
dp2[0] = mul(dp2[0], zerr);
}
dp[u] = 0;
int sm = 0;
for (int j = adj[u].size(); j >= 1; j--) {
sm = ad(sm, dp2[j]);
dp[u] = ad(dp[u], sm);
}
}
void init(int N, int M, std::vector<int> P, std::vector<int> A) {
n = N;
m = M;
for (int i = 0; i < N; i++) {
adj[i].clear();
}
for (int i = 1; i < N + M; i++) {
adj[P[i]].push_back(i);
}
for (int i = 0; i < N; i++) {
tot[i] = adj[i].size();
}
for (int i = N; i < N + M; i++) {
//dp[i] = A[i-N];
dp[i] = 0;
tot[i] = 1;
}
init_tot(0);
for (int i = N-1; i >= 0; i--) {
calc(i);
}
for (int i = N; i < N+M; i++) {
dp[i] = 1;
int cur = P[i];
while (~cur) {
tmp[cur] = dp[cur];
calc(cur);
cur = P[cur];
}
contrib[i] = dp[0];
dp[i] = 0;
cur = P[i];
while (~cur) {
dp[cur] = tmp[cur];
cur = P[cur];
}
}
for (int i = N; i < N+M; i++) {
dp[i] = A[i-N];
}
}
int count_ways(int L, int R) {
for (int i = L; i <= R; i++) {
dp[i] ^= 1;
}
int ans = 0;
for (int i = n; i < n+m; i++) {
ans = ad(ans, mul(dp[i], contrib[i]));
}
return ans;
}
詳細信息
Subtask #1:
score: 2
Accepted
Test #1:
score: 2
Accepted
time: 0ms
memory: 5852kb
input:
1 2 -1 0 0 0 0 1 1 2 2 1 2 2 2 1 2 -1 -1 -2 -2
output:
1 2 0 1 1
result:
ok 7 lines
Test #2:
score: 2
Accepted
time: 1ms
memory: 5844kb
input:
1 1 -1 0 0 1 1 1 1 1 1 1 1 -1 -1 -2 -2
output:
1 0 1 0
result:
ok 6 lines
Test #3:
score: 2
Accepted
time: 1019ms
memory: 5852kb
input:
1 972 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
509 483 489 500 481
result:
ok 7 lines
Test #4:
score: 2
Accepted
time: 1116ms
memory: 5864kb
input:
1 1000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
4 40 428 262 237
result:
ok 7 lines
Test #5:
score: 2
Accepted
time: 1119ms
memory: 5836kb
input:
1 1000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
898 828 828 617 582
result:
ok 7 lines
Test #6:
score: 2
Accepted
time: 1107ms
memory: 5840kb
input:
1 1000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
535 494 500 498 509
result:
ok 7 lines
Test #7:
score: 2
Accepted
time: 1114ms
memory: 6172kb
input:
1 1000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
517 486 511 487 512
result:
ok 7 lines
Test #8:
score: 2
Accepted
time: 1114ms
memory: 5876kb
input:
1 1000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
501 500 499 500 501
result:
ok 7 lines
Subtask #2:
score: 7
Accepted
Test #9:
score: 7
Accepted
time: 1ms
memory: 5824kb
input:
1 2 -1 0 0 0 0 1 1 2 2 1 2 2 2 1 2 -1 -1 -2 -2
output:
1 2 0 1 1
result:
ok 7 lines
Test #10:
score: 7
Accepted
time: 0ms
memory: 5848kb
input:
255 256 -1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 ...
output:
52130940 785285606 585825652
result:
ok 5 lines
Test #11:
score: 7
Accepted
time: 1ms
memory: 5896kb
input:
511 512 -1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 ...
output:
655368480 979089518 133738288 486298234 70832346
result:
ok 7 lines
Test #12:
score: 7
Accepted
time: 0ms
memory: 5832kb
input:
511 512 -1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 ...
output:
640949026 225483138 810019272 225483138 640949026
result:
ok 7 lines
Test #13:
score: 7
Accepted
time: 1ms
memory: 6120kb
input:
511 512 -1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 ...
output:
655368480 457459326 408972838 872925214 486298234
result:
ok 7 lines
Test #14:
score: 7
Accepted
time: 1ms
memory: 5940kb
input:
726 727 -1 0 0 2 1 1 2 3 5 7 9 4 9 7 6 6 11 8 16 12 17 19 3 14 18 16 15 25 10 10 8 27 26 24 20 30 14 18 33 32 4 40 12 25 30 22 43 45 39 46 13 33 23 13 35 26 31 15 57 47 38 22 37 28 41 55 39 43 23 29 64 17 49 67 24 36 55 5 59 62 63 59 48 28 70 11 71 74 76 56 84 66 88 88 56 58 77 27 79 38 74 98 95 44 ...
output:
706880838 491517432
result:
ok 4 lines
Test #15:
score: 7
Accepted
time: 2ms
memory: 5920kb
input:
999 1000 -1 0 1 1 0 4 2 5 5 8 8 3 7 9 6 4 15 16 7 2 11 13 13 18 21 23 12 10 6 20 29 18 16 19 14 31 24 34 35 17 28 26 27 31 29 25 45 43 33 46 32 23 27 42 48 14 15 42 45 37 12 41 59 43 51 57 3 47 40 38 39 64 66 21 56 19 61 59 58 55 26 11 40 77 63 82 48 85 58 53 56 10 22 75 92 91 92 47 81 52 71 96 100 ...
output:
942041994 438937124 841357772 232099870 90068874
result:
ok 7 lines
Test #16:
score: 7
Accepted
time: 2ms
memory: 5928kb
input:
999 1000 -1 0 1 2 3 0 3 6 5 8 6 8 11 9 1 14 10 12 10 13 2 20 4 17 22 13 12 26 15 11 14 27 31 4 30 19 32 18 32 21 38 36 30 19 17 25 23 25 39 27 48 40 41 41 47 38 46 56 54 56 34 45 20 52 57 58 62 65 65 29 40 43 28 54 5 34 26 15 61 67 49 9 43 46 73 76 68 79 87 83 81 47 82 92 68 52 28 86 69 60 93 71 71 ...
output:
846777934 543886020 117265458 170290282 281705356
result:
ok 7 lines
Test #17:
score: 7
Accepted
time: 2ms
memory: 6208kb
input:
999 1000 -1 0 1 0 1 4 2 5 3 2 5 6 3 9 8 6 7 10 15 14 8 11 18 22 19 12 4 25 22 12 21 7 31 17 15 13 30 27 18 11 38 36 27 42 42 40 37 9 13 20 29 10 49 47 43 34 50 55 19 58 28 17 47 48 35 64 36 64 61 33 37 33 62 16 24 53 67 65 73 70 29 26 54 58 69 51 75 14 82 59 59 77 80 63 46 90 56 30 77 94 39 49 68 66...
output:
705376374 644042668 670552036
result:
ok 5 lines
Test #18:
score: 7
Accepted
time: 13ms
memory: 5972kb
input:
999 1000 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
934163262 112313082 337041484 769464108 426960866
result:
ok 7 lines
Test #19:
score: 7
Accepted
time: 12ms
memory: 3932kb
input:
999 1000 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
824177488 180713918 915259054 915239172 406741568
result:
ok 7 lines
Test #20:
score: 7
Accepted
time: 1ms
memory: 5860kb
input:
848 849 -1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 ...
output:
740267208 421935812 842353974 899432906 740267208
result:
ok 7 lines
Subtask #3:
score: 9
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #21:
score: 9
Accepted
time: 2ms
memory: 5904kb
input:
722 938 -1 0 0 0 3 4 0 0 4 2 8 6 6 0 0 12 0 9 12 4 10 18 18 16 6 7 25 6 6 19 27 22 2 11 19 10 14 9 35 16 25 23 25 6 39 14 23 44 36 2 49 11 47 43 32 37 27 23 34 6 43 21 0 32 28 64 12 2 49 49 56 14 70 67 67 27 18 24 75 39 13 53 27 71 77 69 0 32 19 88 66 15 90 71 74 94 28 86 63 80 89 0 69 65 3 104 56 1...
output:
759476520 986929966 529361200 22204736
result:
ok 6 lines
Test #22:
score: 9
Accepted
time: 1ms
memory: 5924kb
input:
807 483 -1 0 1 1 2 0 4 5 2 7 7 10 8 3 11 5 15 12 14 10 14 20 11 12 18 16 23 9 4 19 27 19 22 32 23 28 29 16 20 34 24 37 36 30 8 41 30 15 47 48 33 32 24 46 13 33 49 35 45 43 31 31 56 59 17 22 21 61 62 62 67 37 65 46 55 43 67 60 49 59 48 71 25 61 44 17 72 70 85 84 41 50 64 65 3 44 87 45 88 76 75 34 82 ...
output:
747493058 75435678 304852326 580470868 792077662
result:
ok 7 lines
Test #23:
score: 9
Accepted
time: 0ms
memory: 6168kb
input:
659 548 -1 0 1 2 2 4 5 0 1 7 4 9 3 7 10 8 14 16 15 18 10 2 9 15 13 16 24 7 22 10 8 26 29 17 22 33 0 36 9 21 26 33 26 37 14 41 31 1 37 47 23 36 43 32 42 49 20 23 54 52 56 60 48 44 44 43 29 62 55 66 59 27 64 22 13 66 75 51 60 64 46 70 60 77 8 62 52 77 55 72 77 59 70 68 74 15 91 84 61 3 33 83 74 86 36 ...
output:
738488400 740072304 96397334 825774292 597854808
result:
ok 7 lines
Test #24:
score: 9
Accepted
time: 2ms
memory: 5884kb
input:
1000 1000 -1 0 1 0 1 4 0 4 1 5 9 5 6 10 2 7 1 11 0 0 0 6 1 18 1 21 4 25 3 18 5 6 19 18 18 16 28 17 19 24 20 18 0 24 42 41 34 35 7 24 45 17 16 29 29 53 53 44 39 40 33 41 0 0 11 32 54 46 42 19 64 62 32 15 66 63 12 42 26 56 49 74 77 11 30 80 69 9 7 86 45 69 8 29 90 74 17 78 76 39 90 61 48 85 96 101 91 ...
output:
933758984 95006268 317881142 882413916 585663928
result:
ok 7 lines
Test #25:
score: 9
Accepted
time: 2ms
memory: 5904kb
input:
1000 1000 -1 0 1 1 2 0 0 6 6 8 8 8 9 11 7 11 14 16 16 7 14 7 20 19 7 20 20 25 17 18 12 27 29 32 11 29 17 8 37 7 7 18 31 42 40 40 29 41 14 46 48 40 32 35 18 41 54 32 43 32 57 57 32 37 45 64 56 47 54 62 41 50 34 47 48 37 36 63 25 12 45 65 46 33 37 49 25 86 86 65 64 84 86 64 25 85 41 51 41 71 87 92 75 ...
output:
814713862 179971074 530108958 172714996 724155456
result:
ok 7 lines
Test #26:
score: 9
Accepted
time: 2ms
memory: 5928kb
input:
1000 1000 -1 0 0 0 2 2 2 6 6 5 2 9 6 12 10 8 15 15 14 8 2 7 12 6 5 14 25 0 10 20 20 6 16 3 33 31 15 11 31 10 0 36 27 26 43 27 38 31 42 10 2 24 50 8 2 24 55 55 44 6 51 2 38 61 24 42 22 57 31 57 67 38 65 24 15 24 52 6 23 56 6 51 55 71 18 84 80 54 76 71 75 64 78 62 55 45 16 75 73 63 56 100 51 23 91 86 ...
output:
10265418 663812742 838804900 935588604 32034942
result:
ok 7 lines
Test #27:
score: 9
Accepted
time: 1ms
memory: 6160kb
input:
1000 1000 -1 0 0 1 0 3 2 6 1 0 6 10 0 12 12 3 14 6 13 9 0 16 15 13 20 12 16 0 15 18 26 18 23 20 21 27 18 13 33 18 32 18 39 16 39 29 33 46 3 27 36 35 33 27 23 35 13 49 13 12 48 57 35 43 10 12 57 40 53 15 38 59 20 29 23 60 23 76 23 40 79 66 74 56 77 27 40 40 59 58 31 86 89 65 69 93 70 59 85 56 79 93 9...
output:
726868562 458496628 699307100 591908584 227703358
result:
ok 7 lines
Test #28:
score: 9
Accepted
time: 2ms
memory: 5916kb
input:
1000 1000 -1 0 0 2 2 2 0 0 7 5 8 0 11 7 5 13 8 13 8 16 14 15 13 18 0 21 13 26 22 0 16 17 1 22 26 31 31 27 27 31 7 5 34 15 11 9 12 22 8 25 8 31 29 29 48 50 29 47 29 43 51 36 61 6 15 58 64 63 29 68 58 21 43 7 72 63 33 70 12 18 72 15 56 79 70 56 65 73 77 64 64 56 73 77 64 22 88 40 85 77 73 80 63 89 3 6...
output:
230025634 903738266 10382050 690967620 797613426
result:
ok 7 lines
Test #29:
score: 9
Accepted
time: 1113ms
memory: 6096kb
input:
1 1000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
489 507 492 510 490
result:
ok 7 lines
Test #30:
score: 9
Accepted
time: 1117ms
memory: 5856kb
input:
1 1000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
486 458 478 508 512
result:
ok 7 lines
Test #31:
score: 9
Accepted
time: 0ms
memory: 5956kb
input:
1000 1 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
output:
1 0 1 0 1
result:
ok 7 lines
Test #32:
score: 9
Accepted
time: 0ms
memory: 6204kb
input:
999 1000 -1 0 1 0 2 1 3 5 6 2 7 6 10 9 8 5 4 16 4 11 13 13 7 9 19 24 14 11 19 26 15 18 24 32 29 28 18 22 25 3 35 21 20 40 33 17 35 31 29 37 46 50 49 17 10 45 27 49 39 30 57 42 47 52 56 60 20 58 53 36 62 31 41 59 54 21 47 54 32 36 14 39 74 40 65 38 12 56 73 77 23 58 42 12 76 60 95 87 95 86 71 86 65 9...
output:
952151020 443043678 464032544 372922164 106850846
result:
ok 7 lines
Test #33:
score: 9
Accepted
time: 2ms
memory: 5924kb
input:
499 999 -1 0 1 0 1 3 3 1 6 6 8 0 8 12 5 9 3 6 11 16 12 19 10 5 18 14 8 20 25 14 23 4 30 29 31 24 33 12 31 34 35 29 14 28 15 29 38 11 33 25 47 43 42 5 45 48 30 24 56 23 31 55 42 49 53 16 60 65 37 49 65 25 67 52 56 70 48 47 70 59 47 42 75 73 45 70 84 77 62 60 87 56 71 59 37 87 64 19 32 97 71 76 97 81 ...
output:
331823726 717282174 897711128 622871150 337192684
result:
ok 7 lines
Test #34:
score: 9
Accepted
time: 1ms
memory: 6152kb
input:
249 997 -1 0 1 1 0 3 1 4 2 6 3 8 8 2 10 5 10 0 17 9 19 10 17 10 19 18 18 15 21 26 17 30 25 29 26 0 31 26 35 17 39 18 40 35 39 42 30 22 25 35 17 48 49 26 43 37 54 40 2 50 46 52 47 51 52 39 43 44 61 43 0 29 66 36 70 7 26 62 42 68 25 66 65 68 52 69 69 42 84 70 36 52 82 35 93 54 69 30 82 70 84 70 84 91 ...
output:
552267427 469565478 651807128 810234086 287134027
result:
ok 7 lines
Test #35:
score: 9
Accepted
time: 128ms
memory: 6140kb
input:
4 889 -1 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
235989424 147865831 125587682 158611529 258762404
result:
ok 7 lines
Test #36:
score: 9
Accepted
time: 13ms
memory: 5968kb
input:
1000 1000 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...
output:
588565178 31154578 152598054 815496242 903968456
result:
ok 7 lines
Test #37:
score: 9
Accepted
time: 1148ms
memory: 6264kb
input:
1000 1000 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...
output:
525 470 474 490 492
result:
ok 7 lines
Test #38:
score: 9
Accepted
time: 1148ms
memory: 5968kb
input:
1000 1000 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...
output:
525 474 526 475 521
result:
ok 7 lines
Test #39:
score: 9
Accepted
time: 2ms
memory: 5872kb
input:
719 408 -1 0 1 0 1 1 5 2 5 6 8 9 7 11 13 11 9 12 14 13 19 20 20 17 22 22 25 24 16 28 28 26 25 29 30 32 33 32 37 38 39 40 36 42 33 44 39 45 35 41 49 49 50 43 51 47 53 56 48 58 59 51 55 62 52 58 61 66 67 62 66 70 71 68 60 72 74 75 76 78 69 79 76 64 80 81 85 84 86 83 88 90 91 89 91 89 95 96 97 98 99 10...
output:
33301336 56907144 944497018 704115760 462015690
result:
ok 7 lines
Test #40:
score: 9
Accepted
time: 2ms
memory: 5888kb
input:
510 819 -1 0 0 1 3 3 2 1 4 0 0 5 0 0 13 2 6 15 11 3 4 2 0 6 2 13 15 22 15 23 10 21 3 24 18 17 17 24 4 3 29 40 16 11 10 28 33 38 39 10 38 28 51 41 50 4 3 56 7 44 44 13 9 49 51 23 39 42 23 40 60 1 63 62 55 62 70 55 64 58 50 34 23 80 71 14 71 56 48 79 8 38 28 92 62 61 73 8 46 16 93 56 100 67 23 92 104 ...
output:
216372980 926486360 572278876 442949060 582680282
result:
ok 7 lines
Test #41:
score: 9
Accepted
time: 2ms
memory: 5884kb
input:
363 882 -1 0 0 0 1 3 2 2 6 4 3 0 10 2 6 13 11 1 10 0 18 5 11 1 13 21 11 21 26 27 7 9 21 2 0 3 35 18 23 33 34 10 27 21 21 2 44 38 18 25 44 5 29 45 42 42 25 46 41 43 19 59 26 55 43 23 11 59 57 62 1 27 67 55 73 34 58 63 64 54 4 47 23 32 5 69 47 23 49 4 33 56 82 87 68 65 58 64 0 48 7 32 35 63 49 98 90 8...
output:
860608712 828138786 455393642 548429080 972077788
result:
ok 7 lines
Test #42:
score: 9
Accepted
time: 6ms
memory: 5864kb
input:
44 947 -1 0 1 1 2 1 1 0 1 3 9 1 9 7 5 2 15 10 16 2 14 2 13 15 3 3 11 26 25 27 26 27 28 32 28 29 33 28 25 38 32 39 37 42 0 0 0 1 0 1 1 1 1 1 1 1 2 0 2 2 2 2 0 0 2 1 3 2 1 2 3 3 2 3 2 2 1 3 4 4 2 4 2 1 4 4 4 2 3 2 4 5 0 0 4 2 2 6 4 5 4 1 2 7 1 7 2 3 6 4 7 3 5 3 2 3 1 4 6 3 6 7 4 1 1 0 2 2 3 4 4 2 5 7 ...
output:
319941708 871406470 716326204 656940502 100714900
result:
ok 7 lines
Subtask #4:
score: 0
Time Limit Exceeded
Test #43:
score: 0
Time Limit Exceeded
input:
32767 32768 -1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50...
output:
431985922 394586018 431985922 469385826 506785730 469385826 431985922 469385826 431985922 469385826 506785730 469385826 431985922 394586018 357186114 319786210 357186114 394586018 431985922 394586018 357186114 394586018 431985922 469385826 506785730 469385826 431985922 394586018 357186114 319786210 ...
result:
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Runtime Error
Dependency #2:
100%
Accepted
Test #55:
score: 0
Runtime Error
input:
98261 98262 -1 0 0 1 2 2 4 5 3 8 6 6 1 10 13 10 9 5 12 11 18 17 20 4 18 19 24 11 26 27 24 29 17 29 25 34 7 7 13 21 16 9 23 38 33 25 28 21 37 48 40 46 43 38 49 27 41 22 42 39 58 36 56 32 42 61 22 30 36 47 68 67 59 66 58 23 3 52 39 44 12 8 51 26 74 76 81 65 53 19 59 90 20 83 54 90 77 37 70 67 68 48 73...
output:
result:
Subtask #7:
score: 0
Time Limit Exceeded
Dependency #3:
100%
Accepted
Test #61:
score: 28
Accepted
time: 313ms
memory: 6424kb
input:
2996 2704 -1 0 0 1 1 4 0 1 5 8 5 7 1 12 7 6 12 16 12 7 6 8 4 6 10 21 4 15 27 0 22 12 6 4 16 33 32 18 29 16 32 13 26 18 14 2 12 46 17 1 32 33 26 9 4 39 11 38 51 12 16 48 4 26 13 54 38 46 67 53 67 61 49 17 46 59 70 0 50 29 3 79 6 59 54 82 79 82 39 83 47 62 71 77 93 88 40 85 72 39 61 83 81 89 13 70 44 ...
output:
196037954 353332532 474467362 266572792 133541752 53461032 660114606 850761148 477663050 123824756 363114082 872464786 443857902 566147860 425391966 615113190 557952372 492810162 46040422 829723178 734786500 77970070 304364056 421827402 410653676 699128748 604978864 33254594 555442082 407003562 1477...
result:
ok 71544 lines
Test #62:
score: 28
Accepted
time: 411ms
memory: 6196kb
input:
4101 2507 -1 0 1 2 3 4 4 6 0 7 9 3 8 12 2 11 1 14 7 12 13 10 10 16 21 11 23 25 8 17 18 26 26 16 28 33 27 5 30 33 18 39 20 14 38 37 31 44 20 23 32 48 40 46 51 19 19 45 42 51 57 34 42 25 49 53 36 32 5 56 61 35 22 67 61 65 63 66 50 64 45 71 48 64 81 60 46 13 81 39 58 82 56 90 74 40 69 80 91 38 87 87 10...
output:
342156814 358320976 299380146 839974750 282714570 572663224 932423420 915564092 246626128 128065380 48497606 815538528 361202348 405225742 772957038 994707834 363262654 887329976 513239066 616260340 788922184 497750772 727226928 934935564 210054120 641368152 238239100 88064884 891443850 41490334 440...
result:
ok 100002 lines
Test #63:
score: 28
Accepted
time: 482ms
memory: 6076kb
input:
3417 2851 -1 0 0 2 3 2 4 3 5 1 6 0 10 7 10 11 8 15 17 10 12 4 12 21 16 1 1 11 14 25 8 6 29 32 4 25 35 22 27 35 9 27 14 20 12 40 37 16 23 39 9 47 34 49 24 21 32 33 45 25 11 22 59 34 63 5 55 59 62 62 42 50 22 68 40 38 75 36 68 50 63 52 80 51 8 70 77 19 49 60 24 73 67 80 93 67 15 63 29 40 99 84 36 61 9...
output:
949396966 874968448 624106114 995585060 612947610 530575296 889329008 582844978 116445438 729012664 236198472 578094796 665076398 197563306 39452380 847421978 46418196 102636690 534804282 706965424 586908544 620678032 164289828 176852690 24801678 793047470 109834608 453170222 202347662 457211996 802...
result:
ok 100002 lines
Test #64:
score: 28
Accepted
time: 778ms
memory: 6284kb
input:
5000 5000 -1 0 0 0 2 4 0 5 3 8 2 8 0 2 3 9 8 4 0 17 3 0 3 3 1 4 4 22 4 12 8 2 0 32 7 26 31 19 0 12 11 30 27 27 18 37 27 26 40 0 33 49 16 26 35 0 38 43 28 12 42 29 13 22 59 52 63 43 55 59 0 62 56 2 21 28 29 31 46 47 25 31 81 30 55 59 56 19 38 18 78 72 55 12 24 57 57 81 49 89 6 31 4 28 87 4 38 16 30 4...
output:
702684770 390597720 202778292 801120394 868084796 54893850 481228024 637429104 514520830 312512126 915002006 20467224 22699228 417264510 948663292 897866430 844311774 570833840 328659144 831968810 469375508 423452052 861130186 991447920 178887194 444023618 180355518 899195596 742679406 689124750 991...
result:
ok 100002 lines
Test #65:
score: 28
Accepted
time: 829ms
memory: 6328kb
input:
5000 5000 -1 0 1 0 1 3 3 6 6 7 0 3 3 0 6 11 10 0 17 13 19 20 17 9 17 17 13 26 0 25 19 26 16 26 3 28 28 34 27 37 0 40 32 3 43 43 43 44 41 22 41 44 11 31 11 35 37 40 11 41 45 37 24 25 24 41 55 59 57 48 50 28 57 68 68 62 29 0 68 77 55 43 54 48 68 77 84 41 84 57 40 69 61 49 57 81 34 90 35 78 17 19 81 17...
output:
447289776 646874750 658125210 164310956 722088888 249171358 872822600 130820184 752341892 770508518 609352990 487798736 528888222 991677150 68196636 472210858 367095868 131578900 106170502 156809576 780653914 177684322 854404220 677532818 886854984 59947178 130589076 716462452 514452260 481703990 97...
result:
ok 100002 lines
Test #66:
score: 28
Accepted
time: 834ms
memory: 6392kb
input:
5000 5000 -1 0 1 0 3 0 5 6 0 8 9 8 8 10 5 9 9 11 13 3 0 19 19 12 11 2 23 7 23 0 9 21 29 25 24 16 8 33 26 33 32 39 17 3 5 15 40 8 44 40 29 23 9 15 50 29 53 52 29 27 51 1 32 52 40 62 60 63 48 28 40 52 50 45 69 31 4 48 59 26 62 46 60 66 40 19 85 51 50 51 44 40 60 61 32 28 72 68 80 23 83 72 60 61 94 52 ...
output:
755318398 257540976 384650572 553495018 4327480 179943872 851825334 81212098 340410528 120857714 86133342 916778448 83137086 910662818 824201794 664195982 558395598 112380044 476184664 581407734 420109388 6948194 481903016 955494080 146329262 303245554 778342116 528033092 446014496 291664534 6141869...
result:
ok 100002 lines
Test #67:
score: 28
Accepted
time: 825ms
memory: 6240kb
input:
5000 5000 -1 0 0 0 0 3 3 5 5 3 5 0 5 2 11 3 3 6 9 2 12 0 12 2 12 2 5 6 3 2 28 12 23 5 0 30 34 0 25 34 28 40 22 37 24 35 20 26 11 30 34 46 34 19 39 12 50 39 22 9 50 8 3 38 58 54 28 54 0 32 18 58 28 17 49 11 55 1 52 5 78 54 62 71 12 39 84 25 49 58 43 78 37 92 90 68 58 1 39 58 57 67 86 21 92 86 59 50 5...
output:
832307486 740328038 527847214 292448340 779760122 196703534 752023942 60342270 842040544 369078830 612995262 295326184 699904570 832362908 225910628 809737592 916408194 29359160 212555762 943941470 995298592 952943148 773525898 550787202 996730128 560825216 484406998 925830500 238371804 827565520 60...
result:
ok 100002 lines
Test #68:
score: 28
Accepted
time: 908ms
memory: 6232kb
input:
5000 5000 -1 0 1 0 3 3 4 1 0 5 4 3 5 3 0 11 15 15 3 13 6 11 15 18 9 4 1 25 13 3 3 29 0 30 33 8 13 4 4 29 18 30 36 3 40 37 11 36 35 45 29 43 12 28 30 36 45 47 14 47 32 48 12 45 42 43 11 25 26 15 54 33 55 25 36 27 3 43 14 51 64 76 14 39 82 76 40 18 60 76 3 42 91 82 28 23 29 65 44 39 90 54 33 8 90 99 8...
output:
676832532 723880944 828476384 288471576 890871264 659140978 239078078 632328938 509763372 966128560 320530292 169726780 116930050 729825552 362613402 679813866 566614026 720044826 881501004 74719406 211937424 506809646 399883564 506809646 798457938 148127534 674913066 247814996 107746532 753040352 2...
result:
ok 100002 lines
Test #69:
score: 0
Time Limit Exceeded
input:
1 5000 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
result:
Subtask #8:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
0%