QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#743027 | #9731. Fuzzy Ranking | KJJD | AC ✓ | 101ms | 38900kb | C++20 | 3.2kb | 2024-11-13 17:59:34 | 2024-11-25 12:29:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, k, q;
cin >> n >> k >> q;
vector rk(k, vector<int>(n)), g(n, vector<int>());
for (int i = 0; i < k; i++)
for (int j = 0; j < n; j++)
{
cin >> rk[i][j];
rk[i][j]--;
}
vector<int> scc(n), vis(n), stk, dfn(n), low(n);
int tot = 0, scccnt = 0;
auto tarjan = [&](auto self, int u) -> void {
dfn[u] = low[u] = ++tot;
stk.push_back(u);
vis[u] = 1;
for (auto v : g[u])
{
if (!dfn[v])
{
self(self, v);
low[u] = min(low[u], low[v]);
}
else if (vis[v])
{
low[u] = min(low[u], dfn[v]);
}
}
if (low[u] == dfn[u])
{
int v;
++scccnt;
do
{
v = stk.back();
stk.pop_back();
vis[v] = 0;
scc[v] = scccnt;
} while (v != u);
}
};
for (int i = 0; i < k; i++)
for (int j = 1; j < n; j++)
g[rk[i][j]].push_back(rk[i][j - 1]);
for (int i = 0; i < n; i++)
if (!dfn[i])
tarjan(tarjan, i);
vector Ls(k, vector<int>());
for (int j = 0; j < k; j++)
{
int pre = scc[rk[j][0]];
Ls[j].push_back(0);
for (int i = 1; i < n; i++)
{
if (pre != scc[rk[j][i]])
{
// pref[j].push_back(( i - Ls[j].back() ) * (i - Ls[j].back() - 1) / 2);
Ls[j].push_back(i);
pre = scc[rk[j][i]];
}
}
Ls[j].push_back(n);
}
const int M = Ls[0].size();
vector pref(k, vector<int64_t>(M));
for (int j = 0; j < k; j++)
{
for (int i = 1; i < M; i++)
{
int64_t len = Ls[j][i] - Ls[j][i - 1];
pref[j][i] = pref[j][i - 1] + (len) * (len - 1) / 2;
}
}
int64_t pre = 0;
while (q--)
{
int l, r, id;
cin >> id >> l >> r;
id = (id + pre) % k;
id = 0;
tie(l, r) = minmax((l + pre) % n, (r + pre) % n);
// cout << l << ' ' << r << '\n';
auto L = upper_bound(Ls[id].begin(), Ls[id].end(), l) - Ls[id].begin();
auto R = upper_bound(Ls[id].begin(), Ls[id].end(), r) - Ls[id].begin();
if (L == R)
{
int64_t len = (r - l + 1);
cout << (len) * (len - 1) / 2 << '\n';
pre = (len) * (len - 1) / 2;
continue;
}
int64_t res = pref[id][R - 1] - pref[id][L];
int64_t lcnt = 0, rcnt = 0;
lcnt = Ls[id][L] - l;
rcnt = r - Ls[id][R - 1] + 1;
res += lcnt * (lcnt - 1) / 2;
res += rcnt * (rcnt - 1) / 2;
cout << res << '\n';
pre = res;
}
}
int main()
{
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--)
solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
2 5 2 2 1 2 3 4 5 5 4 3 2 1 1 0 2 1 2 1 5 3 3 1 2 3 4 5 1 3 2 4 5 1 2 3 5 4 0 0 2 0 2 3 1 0 3
output:
3 10 1 1 2
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 13ms
memory: 3636kb
input:
2000 10 10 10 4 5 3 6 8 9 2 1 7 10 4 5 6 3 8 9 1 2 10 7 5 4 3 6 8 9 1 2 7 10 4 5 6 3 8 9 1 2 7 10 4 5 3 6 8 9 2 1 10 7 4 5 6 3 8 9 1 2 10 7 5 4 6 3 8 9 1 2 7 10 5 4 6 3 8 9 1 2 10 7 4 5 6 3 8 9 2 1 7 10 5 4 3 6 8 9 2 1 10 7 3 1 6 5 7 8 0 2 3 7 9 9 2 1 9 6 1 6 7 2 3 0 0 4 1 8 1 1 8 7 10 10 10 9 10 5 ...
output:
1 1 0 0 3 2 0 2 2 4 1 0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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 200000 lines
Test #6:
score: 0
Accepted
time: 15ms
memory: 4160kb
input:
10 20 1000 2000 2 5 1 3 12 16 14 15 7 4 19 13 18 10 20 9 11 8 6 17 5 2 12 1 16 3 19 4 7 15 14 18 13 10 9 20 11 8 6 17 2 5 1 16 12 3 7 14 4 19 15 13 18 10 20 9 11 17 6 8 2 5 1 16 3 12 15 7 4 14 19 18 13 10 9 20 11 8 6 17 5 2 3 12 1 16 14 7 4 15 19 18 13 10 20 9 11 6 17 8 2 5 3 1 12 16 19 15 7 4 14 18...
output:
11 0 11 10 1 11 5 10 10 5 13 2 0 18 2 14 2 18 10 13 1 1 0 1 4 7 6 0 15 11 1 4 6 19 3 9 3 1 0 20 2 16 1 0 3 2 3 0 18 1 17 1 1 8 1 5 17 1 3 6 1 2 15 15 2 1 0 3 18 22 0 1 2 15 13 12 20 3 0 9 15 1 4 17 22 16 8 6 13 0 7 11 15 19 15 6 7 10 17 12 9 1 11 1 0 4 6 17 1 17 6 5 1 1 16 14 3 1 12 18 1 0 18 12 17 ...
result:
ok 20000 lines
Test #7:
score: 0
Accepted
time: 21ms
memory: 3988kb
input:
33 3 2000 2000 1 2 3 2 1 3 2 1 3 2 1 3 1 2 3 2 1 3 2 1 3 1 2 3 2 1 3 1 2 3 2 1 3 2 1 3 2 1 3 1 2 3 2 1 3 2 1 3 2 1 3 1 2 3 2 1 3 2 1 3 1 2 3 1 2 3 2 1 3 1 2 3 2 1 3 1 2 3 2 1 3 1 2 3 2 1 3 2 1 3 1 2 3 2 1 3 2 1 3 2 1 3 1 2 3 2 1 3 1 2 3 1 2 3 2 1 3 1 2 3 1 2 3 1 2 3 1 2 3 2 1 3 2 1 3 1 2 3 2 1 3 2 1...
output:
1 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 1 1 0 0 0 1 1 0 1 1 0 1 0 1 0 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 0 0 1 1 1 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 ...
result:
ok 66000 lines
Test #8:
score: 0
Accepted
time: 43ms
memory: 4044kb
input:
10 100 200 20000 33 77 70 12 88 3 29 59 63 41 75 18 42 83 96 44 67 73 79 48 92 54 78 93 21 14 24 72 91 25 71 97 2 89 76 20 37 95 68 87 39 31 5 100 9 23 74 80 7 27 50 69 52 82 81 85 56 84 34 32 17 36 11 16 8 57 49 30 60 86 62 99 13 19 98 43 6 4 46 58 64 45 51 53 10 28 90 26 40 94 35 22 61 15 47 1 55 ...
output:
1 4 2 3 2 4 0 2 1 1 1 0 0 4 0 4 3 2 2 1 4 0 4 0 2 2 4 2 2 0 2 2 1 0 0 1 3 2 2 0 0 0 3 2 0 1 4 1 2 2 3 1 3 0 2 1 1 4 2 1 0 0 3 0 0 2 0 2 4 3 0 4 0 0 3 0 2 2 0 4 3 4 2 3 2 0 2 0 1 1 2 1 2 1 4 0 1 0 1 2 0 2 4 1 0 2 4 2 3 1 4 2 0 2 0 2 0 2 2 0 1 2 1 2 0 3 2 1 2 1 1 4 1 1 1 2 1 2 2 1 0 2 0 1 0 1 1 1 0 2 ...
result:
ok 200000 lines
Test #9:
score: 0
Accepted
time: 54ms
memory: 7016kb
input:
1 316 632 200000 36 93 100 184 246 134 89 157 219 9 18 29 8 109 159 3 255 66 257 27 290 286 283 132 216 175 167 208 238 31 220 296 271 113 269 127 156 300 121 267 99 122 90 288 64 210 28 144 262 60 53 6 96 268 276 279 13 174 287 78 295 72 143 155 146 197 107 35 24 88 187 110 163 204 2 25 226 119 164...
output:
7 87 10 47 74 55 79 64 19 2 104 21 54 1 4 72 81 57 12 74 28 77 82 77 7 22 56 6 81 4 28 24 56 19 25 7 7 4 64 68 51 16 95 23 67 31 33 45 72 69 65 7 24 11 85 25 0 1 0 20 72 43 56 12 16 76 98 91 50 84 23 71 8 14 22 49 64 3 24 2 15 5 90 11 26 40 3 12 4 23 88 65 34 42 25 4 80 3 6 20 41 83 12 10 43 24 3 77...
result:
ok 200000 lines
Test #10:
score: 0
Accepted
time: 62ms
memory: 7028kb
input:
1 632 316 200000 625 142 323 331 85 521 376 51 411 31 418 11 16 66 112 611 459 622 148 247 122 587 249 141 20 88 439 334 233 474 305 381 203 559 228 595 326 535 128 449 138 28 86 56 109 102 428 194 612 256 466 598 189 539 237 59 225 528 200 330 490 560 133 57 590 632 422 213 340 310 49 195 41 217 19...
output:
60 34 45 304 31 71 52 36 123 38 76 28 200 223 55 58 11 275 202 76 285 30 154 113 40 48 355 332 358 33 240 46 29 91 147 75 318 62 162 200 171 124 228 31 285 59 16 206 114 44 163 87 53 65 221 298 23 172 123 91 298 14 57 6 8 71 1 84 3 2 58 20 6 111 244 220 25 137 86 269 134 254 68 64 129 14 65 108 43 3...
result:
ok 200000 lines
Test #11:
score: 0
Accepted
time: 52ms
memory: 6196kb
input:
1 447 447 200000 108 218 332 238 439 329 405 417 75 380 227 395 285 112 24 290 141 390 269 155 364 36 79 403 170 284 348 250 93 331 232 90 419 228 21 424 213 365 353 404 274 144 146 291 88 29 44 12 362 233 312 369 400 95 142 17 327 111 414 86 58 314 163 401 358 197 441 157 160 40 220 180 283 10 63 6...
output:
720 254 101 688 77 209 15 516 644 262 61 102 719 85 49 52 471 94 275 145 3 714 101 385 407 241 154 441 839 247 124 278 100 290 408 290 567 42 72 320 296 528 471 420 293 295 688 516 354 159 812 468 487 671 190 514 396 154 887 64 119 125 604 27 901 669 651 148 432 673 291 183 3 123 946 722 783 382 367...
result:
ok 200000 lines
Test #12:
score: 0
Accepted
time: 69ms
memory: 6656kb
input:
2 10000 10 100000 9169 6526 4977 9620 6327 8688 1778 4867 8252 2611 762 6164 1606 5796 6803 7006 5759 9972 8099 6268 5700 9868 896 2146 7128 1326 2696 2311 8764 6495 8013 6340 8057 6116 8447 5480 6736 9968 1048 1357 9013 8647 2334 8332 1514 6336 1486 5441 2963 2814 6910 4862 9616 1340 9839 3105 3703...
output:
43 225 406 1980 718 2299 362 985 1715 111 2449 1855 241 1928 461 1018 2304 1158 2562 446 176 1874 1743 8 165 1024 1025 2514 267 2165 1126 428 1804 14 969 590 765 1839 293 2166 1189 434 83 1862 916 48 2000 126 1170 101 2535 809 1422 589 123 44 1265 794 1025 1568 88 1483 498 2464 904 511 997 305 513 2...
result:
ok 200000 lines
Test #13:
score: 0
Accepted
time: 42ms
memory: 6060kb
input:
2 10 10000 100000 6 7 9 4 3 8 10 5 2 1 6 7 9 5 10 4 8 3 2 1 6 7 9 4 10 8 3 5 1 2 6 7 9 5 10 8 3 4 1 2 6 7 9 8 10 3 4 5 1 2 6 7 9 5 3 8 4 10 1 2 6 7 9 5 10 8 4 3 1 2 6 7 9 3 4 5 10 8 1 2 6 7 9 4 8 10 5 3 1 2 6 7 9 8 3 4 5 10 1 2 6 7 9 4 3 8 10 5 1 2 6 7 9 8 5 4 3 10 1 2 6 7 9 8 4 3 5 10 1 2 6 7 9 3 4...
output:
6 0 1 10 4 10 1 1 0 1 3 0 1 0 3 3 6 1 0 0 11 0 3 4 1 10 1 1 0 3 3 7 6 10 11 4 1 11 0 1 0 1 10 6 6 6 0 10 6 0 2 10 10 0 3 1 3 0 0 0 0 6 0 1 6 10 1 6 2 6 2 0 4 1 1 3 10 11 0 6 1 6 0 6 1 11 3 10 11 0 10 10 11 3 1 6 10 0 6 0 11 6 11 3 0 1 0 10 6 0 0 10 0 0 1 11 3 0 11 10 1 0 3 3 6 3 0 1 3 1 6 11 10 10 3...
result:
ok 200000 lines
Test #14:
score: 0
Accepted
time: 52ms
memory: 36060kb
input:
1 1 200000 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 200000 lines
Test #15:
score: 0
Accepted
time: 50ms
memory: 19792kb
input:
1 2 100000 200000 2 1 2 1 1 2 1 2 2 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 2 1 2 2 1 2 1 2 1 2 1 2 1 1 2 1 2 2 1 1 2 2 1 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 2 2 1 1 2 1 2 2 1 1 2 1 2 2 1 2 1 2 1 1 2 1 2 1 2 2 1 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 2 1 2 2 1 1 2 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 2 1 2 ...
output:
1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 1 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 ...
result:
ok 200000 lines
Test #16:
score: 0
Accepted
time: 46ms
memory: 10284kb
input:
1 5 40000 200000 3 5 2 4 1 2 3 5 1 4 3 2 5 1 4 5 3 2 4 1 3 2 5 1 4 2 5 3 1 4 2 5 3 1 4 2 5 3 4 1 2 3 5 1 4 5 3 2 1 4 5 3 2 4 1 5 2 3 4 1 2 3 5 1 4 3 2 5 1 4 2 3 5 1 4 2 3 5 4 1 3 5 2 1 4 2 5 3 4 1 5 3 2 4 1 3 5 2 4 1 5 2 3 4 1 3 5 2 4 1 2 5 3 1 4 2 3 5 1 4 5 3 2 4 1 5 3 2 1 4 2 5 3 4 1 5 2 3 4 1 5 3...
output:
0 1 3 3 1 3 1 1 2 2 0 1 1 3 0 3 0 0 4 0 0 3 2 3 1 0 0 4 0 4 4 0 1 0 0 3 2 4 1 3 0 0 0 4 4 1 2 1 3 0 3 4 1 0 4 1 2 0 1 1 1 3 0 1 1 1 1 1 3 3 2 0 2 0 4 0 0 1 2 1 3 1 3 0 0 1 0 1 1 3 2 1 0 0 1 1 3 1 1 0 4 1 1 3 1 1 1 1 0 3 1 0 1 1 1 0 1 2 1 1 0 1 0 1 3 1 2 0 0 1 3 4 3 3 3 0 0 3 3 0 3 0 3 2 1 3 3 0 3 2 ...
result:
ok 200000 lines
Test #17:
score: 0
Accepted
time: 52ms
memory: 9688kb
input:
1 10 20000 200000 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1 6 8 10 7 4 9 3 5 2 1...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 200000 lines
Test #18:
score: 0
Accepted
time: 52ms
memory: 7280kb
input:
1 100 2000 200000 37 43 40 88 30 84 23 46 92 70 61 8 60 34 26 62 18 49 35 50 90 55 25 64 51 29 13 79 36 47 28 9 82 14 58 99 44 73 98 94 53 19 33 20 56 67 57 24 52 21 2 38 96 54 11 72 74 68 6 63 69 81 12 95 5 76 86 48 65 7 10 39 17 71 27 1 3 83 91 93 85 42 97 4 75 59 15 100 77 78 31 22 89 87 66 80 45...
output:
9 4 8 3 0 6 11 0 6 2 18 7 1 3 0 0 21 23 6 18 9 0 3 18 6 1 17 1 14 9 3 10 25 19 3 6 2 10 0 6 18 21 13 18 7 8 18 3 0 1 20 12 8 6 2 6 2 24 21 1 20 19 3 10 11 8 1 0 10 12 24 0 11 24 6 1 2 10 18 22 2 25 9 12 20 19 18 1 6 18 4 4 9 9 6 24 9 21 9 3 19 23 8 13 18 3 11 10 9 18 23 1 6 11 2 12 2 6 10 21 6 11 2 ...
result:
ok 200000 lines
Test #19:
score: 0
Accepted
time: 56ms
memory: 6072kb
input:
1 400 500 200000 171 260 393 268 114 196 399 137 170 33 372 354 330 67 184 107 13 134 200 241 191 307 87 255 123 57 353 18 54 53 211 90 75 380 74 288 40 227 71 101 159 261 295 41 284 163 400 287 226 210 126 291 157 192 363 143 66 69 117 77 244 301 73 256 158 8 139 398 277 273 388 213 141 110 333 351...
output:
213 601 167 435 337 168 427 100 235 292 148 101 42 1 227 402 67 28 328 489 467 32 528 182 32 445 360 143 407 619 370 12 111 592 121 311 274 12 511 119 531 247 114 489 38 117 53 451 223 245 277 413 340 387 330 107 318 138 398 120 53 145 199 299 134 390 289 238 464 148 258 583 475 114 483 0 248 152 30...
result:
ok 200000 lines
Test #20:
score: 0
Accepted
time: 55ms
memory: 7064kb
input:
1 500 400 200000 461 323 58 224 458 139 135 457 166 203 302 400 260 281 81 265 357 158 470 463 271 294 239 56 38 90 141 162 421 293 33 442 87 447 437 80 173 287 122 169 430 215 268 95 156 242 52 371 387 85 104 340 438 159 471 335 168 124 409 453 484 63 107 151 362 243 211 178 117 477 240 214 114 2 3...
output:
55 1 66 16 33 9 1 28 18 74 17 69 40 97 22 24 124 35 62 108 23 98 85 4 74 37 3 13 0 92 66 15 53 46 22 17 62 64 59 42 26 6 40 4 81 44 76 25 44 7 61 129 10 15 46 47 59 47 54 45 27 19 53 20 46 15 62 96 33 14 97 104 72 84 16 17 75 48 9 15 100 34 53 1 75 22 50 33 40 39 25 18 55 33 44 16 0 35 111 86 10 18 ...
result:
ok 200000 lines
Test #21:
score: 0
Accepted
time: 62ms
memory: 7312kb
input:
1 2000 100 200000 712 25 1015 522 16 1691 691 1946 636 1124 1095 346 589 1092 370 440 1891 1272 1758 1375 802 1436 1152 1799 931 1172 1515 510 828 1754 740 1695 1524 1562 977 611 383 1990 29 556 958 1439 871 1466 1623 377 1899 1773 239 304 1536 148 1335 428 1336 1844 1248 926 1779 1244 1268 75 11 50...
output:
525 233 137 597 291 313 26 97 102 25 127 177 280 53 3 162 289 70 250 15 625 220 26 331 486 322 28 140 448 229 373 138 441 188 350 283 249 463 538 509 59 44 674 536 3 27 472 344 94 62 48 134 887 23 131 6 788 365 65 107 603 15 347 10 276 210 339 3 255 308 464 411 271 108 501 514 52 47 237 469 40 320 1...
result:
ok 200000 lines
Test #22:
score: 0
Accepted
time: 80ms
memory: 10492kb
input:
1 20000 10 200000 8141 10020 19324 3998 14442 18334 17523 2850 10414 12871 13638 11567 15766 18025 880 5004 17066 16602 14730 17522 15211 5771 1424 8644 16190 9856 3874 3755 3959 5906 19711 17647 6331 10957 4442 18108 4404 373 18845 18166 18996 14637 9192 2869 3337 7368 9315 14490 17072 16058 7935 1...
output:
142 96 166 22 81 17 77 33 25 103 3 136 135 40 64 67 107 40 152 168 78 152 38 3 100 81 56 20 60 1 114 7 180 35 28 88 12 215 0 27 193 39 4 20 20 31 6 86 32 46 181 54 27 156 45 28 103 225 187 11 47 65 97 57 181 79 158 62 206 215 5 50 76 19 159 181 67 11 118 183 148 65 114 10 26 49 184 81 226 55 113 62 ...
result:
ok 200000 lines
Test #23:
score: 0
Accepted
time: 73ms
memory: 11228kb
input:
1 40000 5 200000 20677 23781 23870 25149 12506 14538 2892 37410 7491 21274 7355 32112 29017 9866 30955 9254 13607 19084 23713 2706 26314 25189 36877 17894 35833 38566 24827 9769 20556 37725 14270 33822 24283 39456 36715 14920 31774 11429 33715 28225 6440 23279 11401 28541 7424 37561 20402 24879 2078...
output:
101493 103152 17126 62978 100363 55783 117284 21090 8264 60771 61197 52882 110071 22849 95884 69618 18988 89717 60345 129995 154847 107112 8318 59811 36834 6291 743 53096 28805 176707 53365 60687 2409 22998 15424 64743 26541 6633 73342 49382 6982 8289 70594 82626 119661 35276 126340 20511 13705 8283...
result:
ok 200000 lines
Test #24:
score: 0
Accepted
time: 85ms
memory: 18708kb
input:
1 100000 2 200000 62459 94167 23908 9627 2233 86760 90406 52415 40336 39084 36937 82338 80917 36979 30033 64712 37298 49382 27749 58792 4349 12218 13278 92089 66971 66710 53629 76436 79832 19474 99635 84896 35429 76047 6996 98919 46673 39012 77523 68247 43575 74589 81419 72018 95767 42542 97695 9011...
output:
2925 4468 838 983 1106 2742 1536 1452 211 9688 2938 8644 5932 1887 8096 5488 4889 952 4554 4621 531 1667 9833 1453 1134 2008 9372 9017 958 1549 427 757 1162 4189 587 5944 1893 9899 6925 2121 1903 4258 4391 9526 6412 1304 7908 3291 4451 4888 5951 3113 4369 10636 2311 10389 3644 1185 3754 5845 1151 12...
result:
ok 200000 lines
Test #25:
score: 0
Accepted
time: 94ms
memory: 38900kb
input:
1 200000 1 200000 99503 80429 182268 48621 174317 126326 125560 185423 136721 93400 45419 24982 149684 165872 156663 106576 116630 134385 128123 40235 102009 114101 146057 47520 79869 99227 32089 111152 130530 60562 145375 137181 166464 111936 40552 10623 100005 124028 70197 193105 94374 157487 1170...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 200000 lines
Test #26:
score: 0
Accepted
time: 101ms
memory: 3628kb
input:
200000 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 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 0 0 0 0 ...
result:
ok 96625 lines
Extra Test:
score: 0
Extra Test Passed