QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#798151 | #168. Cube Dividing | liyujia | AC ✓ | 587ms | 65068kb | C++17 | 1.7kb | 2024-12-04 08:48:54 | 2024-12-04 08:48:56 |
Judging History
answer
#include <bits/stdc++.h>
#define P pair <int, int>
using namespace std;
const int N = 2000005;
int A, B, C, n, f[N], isb[N];
struct S{ int x, y, z;};
bool operator <(S x, S y){ return x.x != y.x? x.x < y.x: x.y != y.y? x.y < y.y: x.z < y.z;}
bool operator ==(S x, S y){ return x.x == y.x && x.y == y.y && x.z == y.z;}
vector <S> blk, pt;
int find(int x){ return f[x] == x? x: f[x] = find(f[x]);}
void slv(int x){
map <P, vector <P> > mp;
for(int j = 0; j < pt.size(); j++){
S i = pt[j];
mp[x == 0? (P){i.y, i.z}: x == 1? (P){i.x, i.z}: (P){i.x, i.y}].push_back({x == 0? i.x: x == 1? i.y: i.z, j});
}
for(auto i: mp){
auto v = i.second;
sort(v.begin(), v.end());
for(int j = 1; j < v.size(); j++){
int d1 = v[j - 1].second, d2 = v[j].second;
if(isb[d1] || isb[d2]) continue;
f[find(d1)] = find(d2);
}
}
}
int main(){
cin >> A >> B >> C >> n;
for(int i = 1, x, z, y; i <= n; i++){
cin >> x >> y >> z;
blk.push_back({x, y, z});
for(int dx: {x - 1, x, x + 1}) for(int dy: {y - 1, y, y + 1}) for(int dz: {z - 1, z, z + 1}){
if(dx < 0 || dy < 0 || dz < 0 || dx >= A || dy >= B || dz >= C) continue;
pt.push_back({dx, dy, dz});
}
for(int dx: {0, x, A - 1}) for(int dy: {0, y, B - 1}) for(int dz: {0, z, C - 1}) pt.push_back({dx, dy, dz});
}
for(int dx: {0, A - 1}) for(int dy: {0, B - 1}) for(int dz: {0, C - 1}) pt.push_back({dx, dy, dz});
sort(pt.begin(), pt.end()), pt.resize(unique(pt.begin(), pt.end()) - pt.begin());
for(S i: blk) isb[lower_bound(pt.begin(), pt.end(), i) - pt.begin()] = 1;
n = pt.size(); iota(f, f + n, 0);
slv(0), slv(1), slv(2); int ans = 0;
for(int i = 0; i < n; i++) ans += f[i] == i && !isb[i];
cout << ans;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5920kb
input:
2 2 2 4 0 0 0 1 1 0 1 0 1 0 1 1
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5624kb
input:
3 3 3 1 1 1 1
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5720kb
input:
1 1 3 2 0 0 0 0 0 2
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 35ms
memory: 11756kb
input:
8 60 66 8004 4 49 31 0 38 42 0 45 22 1 19 23 1 36 47 6 9 15 7 55 18 4 24 51 4 34 31 0 31 64 5 24 23 0 48 34 6 30 12 6 41 22 3 6 51 3 43 34 4 49 39 5 31 5 3 36 63 5 37 21 4 11 55 6 53 41 6 51 56 6 42 9 4 59 55 3 30 49 5 15 32 3 59 64 5 7 32 2 42 60 3 0 27 7 5 41 3 34 45 5 39 57 3 24 36 0 16 13 1 55 3...
output:
15
result:
ok single line: '15'
Test #5:
score: 0
Accepted
time: 62ms
memory: 13296kb
input:
97 26 86 6966 67 4 0 63 2 45 30 1 66 37 12 70 54 10 50 61 13 14 82 10 29 76 20 42 66 14 45 8 19 65 2 0 63 42 19 24 11 21 23 65 2 56 65 24 61 33 15 17 51 0 26 2 19 51 7 21 38 53 15 57 73 13 42 38 13 10 78 22 52 83 15 14 68 13 55 50 5 62 70 0 17 56 2 84 93 13 29 44 6 40 58 13 1 15 17 66 38 21 59 2 16 ...
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 59ms
memory: 18080kb
input:
80 33 9 14465 35 15 4 24 9 4 59 30 8 18 15 6 64 2 4 54 5 6 49 29 1 38 12 8 1 5 4 29 23 0 70 25 5 26 15 2 11 18 7 47 30 5 37 30 3 54 29 1 73 23 5 22 31 8 31 28 7 4 11 2 65 10 8 64 15 1 25 31 7 58 2 5 72 2 2 49 15 3 50 18 5 36 22 1 19 21 7 29 31 6 31 25 0 54 30 3 15 24 1 7 18 7 38 6 7 57 20 8 32 16 0 ...
output:
857
result:
ok single line: '857'
Test #7:
score: 0
Accepted
time: 67ms
memory: 18632kb
input:
52 78 36 9942 35 64 32 40 33 27 9 69 5 24 3 19 46 30 5 40 11 5 47 28 13 15 56 30 1 1 2 43 24 35 48 31 33 49 13 31 35 36 2 25 45 0 14 67 26 30 52 23 1 45 13 3 47 0 7 40 28 21 0 4 19 64 8 32 26 17 19 29 12 7 8 24 42 3 15 21 39 11 35 41 13 47 28 22 18 5 18 40 67 23 36 75 12 35 21 10 16 59 0 25 13 10 51...
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 126ms
memory: 24460kb
input:
51 84 87 15969 40 48 55 26 8 25 36 80 48 40 13 16 32 68 60 19 2 45 16 38 38 49 22 70 36 66 76 21 51 86 24 9 80 50 78 36 9 78 50 9 35 2 49 63 83 16 52 0 50 58 76 47 43 66 37 3 71 14 70 86 49 48 66 39 74 80 34 16 24 9 34 54 49 65 54 16 77 17 18 73 84 35 61 45 39 16 38 21 2 46 48 5 7 22 17 64 14 35 38 ...
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 119ms
memory: 21880kb
input:
58 55 66 17448 53 12 4 23 49 53 53 8 55 57 12 42 51 47 34 20 45 24 48 37 2 0 24 28 33 4 38 1 26 56 57 17 31 6 14 31 36 36 26 33 0 40 24 1 50 37 0 45 15 32 59 40 19 31 32 54 50 29 9 38 32 42 40 21 47 21 46 48 65 21 13 46 50 17 37 5 47 19 56 44 41 15 20 44 10 43 2 37 2 7 39 11 7 34 10 55 8 46 24 18 41...
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 60ms
memory: 16716kb
input:
31 49 22 14484 7 46 11 10 29 1 15 0 8 11 10 3 14 9 5 22 3 4 9 27 18 13 40 13 28 20 7 4 28 12 4 44 21 15 10 17 4 8 12 17 25 15 30 11 0 24 8 6 24 37 2 1 4 6 8 47 16 26 33 14 3 26 14 11 24 13 19 41 15 13 10 19 24 38 12 30 28 13 12 0 9 5 4 6 18 16 20 13 20 13 29 8 21 27 2 18 19 2 19 23 41 7 25 32 2 25 1...
output:
205
result:
ok single line: '205'
Test #11:
score: 0
Accepted
time: 48ms
memory: 12324kb
input:
65 36 42 8374 5 21 22 44 30 18 50 1 35 16 34 37 54 30 4 28 33 8 12 31 24 32 28 15 45 11 27 12 34 15 36 10 6 52 34 7 37 25 32 6 5 3 53 17 32 17 25 6 45 34 13 5 13 41 56 24 27 45 11 9 15 28 0 42 4 14 50 30 40 61 0 26 51 4 31 59 13 1 39 5 12 11 28 9 55 19 25 12 18 14 58 35 4 14 3 41 59 5 34 24 22 22 30...
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 30ms
memory: 8848kb
input:
24 49 106 3104 7 32 74 19 29 65 8 31 71 10 7 74 0 21 49 16 6 100 11 5 97 6 5 43 21 9 88 6 11 22 16 38 40 4 30 14 2 27 101 17 8 84 12 44 56 6 21 4 19 42 0 10 29 71 1 17 92 16 15 76 0 43 43 23 47 99 14 27 64 17 47 19 0 8 35 19 26 39 23 30 74 13 30 35 19 37 49 4 1 87 12 17 50 22 30 2 14 3 38 23 10 105 ...
output:
1
result:
ok single line: '1'
Test #13:
score: 0
Accepted
time: 47ms
memory: 13104kb
input:
14 92 57 6904 10 47 23 12 77 13 12 34 39 4 79 23 3 60 39 2 42 20 2 25 3 2 33 52 6 32 3 2 72 13 2 88 29 6 29 35 13 27 49 1 44 15 0 56 36 4 18 10 2 35 22 5 11 33 6 4 29 8 8 43 7 73 28 2 9 45 6 27 43 0 71 29 9 22 46 8 1 23 3 64 12 12 89 1 11 41 56 12 25 51 13 21 52 10 85 41 6 70 44 3 14 1 8 2 26 9 35 4...
output:
2
result:
ok single line: '2'
Test #14:
score: 0
Accepted
time: 373ms
memory: 46916kb
input:
883659 73120 315984 13620 356561 25749 95618 703272 39911 262803 491727 19022 72760 70333 17287 153234 97287 33099 183707 824073 26403 296847 810501 53197 224664 751333 40590 147652 477481 66750 310506 311528 62992 8676 89763 58901 253720 698886 31886 41966 514225 56832 252776 792753 51105 160521 14...
output:
1
result:
ok single line: '1'
Test #15:
score: 0
Accepted
time: 487ms
memory: 54440kb
input:
324302 445977 917979 17452 125069 220918 216779 35630 1072 403457 231031 437649 901553 194958 244880 545564 89610 119440 532432 160581 30197 164902 130088 341024 110278 308124 80539 631170 162759 337540 398836 170540 353858 134156 267624 351491 330475 102540 254576 379531 271164 288911 455726 145606...
output:
1
result:
ok single line: '1'
Test #16:
score: 0
Accepted
time: 515ms
memory: 59580kb
input:
476922 692806 26199 18828 393771 546899 10840 440983 606547 15031 389272 266105 24628 462562 204800 11320 171370 222866 21872 419614 621262 22489 389347 112725 22209 463156 346970 19224 350989 513377 18930 192024 644329 15346 163295 316179 15116 212996 683052 18780 206573 23761 22973 407692 28936 58...
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 233ms
memory: 33344kb
input:
34295 450436 484714 9110 30469 162145 376280 28325 374106 467569 486 36256 192154 13098 328175 333483 21107 349376 262223 17979 370500 197997 6894 174652 402872 10792 368389 305356 27697 296425 33743 20488 418859 185348 2607 156097 423677 24168 86231 338225 2763 391351 46707 4972 202813 102465 4488 ...
output:
1
result:
ok single line: '1'
Test #18:
score: 0
Accepted
time: 11ms
memory: 8028kb
input:
366753 49845 80666 977 205923 23224 70485 292244 47685 67796 217195 38820 70291 27387 21935 38966 352637 14805 42924 59337 3127 56783 293397 28614 54903 330283 26886 42058 319651 7541 43271 100022 25004 45893 327459 43954 20688 308516 23112 8279 338600 11828 31001 255036 8021 3407 275032 29861 61389...
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 44ms
memory: 15884kb
input:
413 1 41 16884 0 0 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 37 0 0 38 0 0 39 0 0 40 1 0 0 1 ...
output:
49
result:
ok single line: '49'
Test #20:
score: 0
Accepted
time: 69ms
memory: 16560kb
input:
2 14 595 16639 1 11 8 0 11 304 0 10 540 0 2 138 0 1 318 1 8 452 0 9 14 1 9 81 0 9 300 1 12 305 0 4 515 0 13 150 1 1 56 0 10 510 1 6 83 1 1 300 1 11 63 1 5 190 0 1 259 1 3 37 1 2 254 1 13 501 0 9 256 0 12 489 0 8 236 1 3 321 1 3 281 0 10 461 0 11 537 1 3 242 0 10 107 0 2 431 1 0 466 1 11 162 0 8 164 ...
output:
21
result:
ok single line: '21'
Test #21:
score: 0
Accepted
time: 48ms
memory: 16816kb
input:
1 10 1965 19634 0 0 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 37 0 0 38 0 0 39 0 0 40 0 0 41 ...
output:
16
result:
ok single line: '16'
Test #22:
score: 0
Accepted
time: 27ms
memory: 11124kb
input:
2 1 5723 11417 0 0 582 1 0 2484 1 0 987 0 0 5402 0 0 5668 1 0 5384 1 0 245 0 0 5602 1 0 3950 0 0 37 1 0 4874 1 0 2676 0 0 3377 1 0 4766 0 0 1108 0 0 2916 1 0 1003 0 0 43 0 0 819 1 0 5256 0 0 1346 0 0 5549 0 0 157 1 0 4499 0 0 646 1 0 613 1 0 2592 0 0 1836 0 0 4725 0 0 5417 1 0 2750 1 0 4791 0 0 5562...
output:
29
result:
ok single line: '29'
Test #23:
score: 0
Accepted
time: 38ms
memory: 11880kb
input:
2 97 57 11046 0 0 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 37 0 0 38 0 0 39 0 0 40 0 0 41 0 ...
output:
12
result:
ok single line: '12'
Test #24:
score: 0
Accepted
time: 21ms
memory: 10320kb
input:
1 4172 2 8342 0 926 1 0 1209 0 0 3560 1 0 1789 0 0 2291 1 0 627 0 0 2664 1 0 2051 0 0 1599 0 0 2392 0 0 1669 1 0 2871 1 0 1881 1 0 2903 0 0 1259 1 0 3599 1 0 111 0 0 202 1 0 3111 0 0 1042 1 0 3730 0 0 3306 0 0 1303 1 0 1651 1 0 2234 1 0 4053 1 0 1443 0 0 2894 0 0 1031 1 0 925 1 0 1445 0 0 690 1 0 40...
output:
2
result:
ok single line: '2'
Test #25:
score: 0
Accepted
time: 38ms
memory: 11540kb
input:
6 41 40 9797 0 0 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 37 0 0 38 0 0 39 0 1 0 0 1 1 0 1 2...
output:
43
result:
ok single line: '43'
Test #26:
score: 0
Accepted
time: 48ms
memory: 17468kb
input:
11 369 3 12167 6 351 2 4 305 1 6 320 0 7 285 1 8 218 1 1 351 0 7 315 2 7 214 1 3 105 2 5 351 1 7 13 0 3 360 0 4 171 1 5 131 1 4 251 0 1 254 1 9 78 1 1 317 0 5 316 0 3 100 2 9 99 2 8 146 0 2 49 2 0 270 1 0 230 2 10 134 0 5 75 2 5 16 0 4 66 1 10 53 1 9 119 0 10 347 0 3 274 1 6 66 0 9 334 2 1 142 1 9 3...
output:
10
result:
ok single line: '10'
Test #27:
score: 0
Accepted
time: 36ms
memory: 13252kb
input:
17 858 1 14581 0 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 37 0 0 38 0 0 39 0 0 40 0 0 41 0 0...
output:
5
result:
ok single line: '5'
Test #28:
score: 0
Accepted
time: 14ms
memory: 8536kb
input:
1 107 55 5884 0 57 30 0 59 36 0 55 16 0 63 42 0 68 19 0 97 48 0 85 17 0 35 26 0 80 40 0 92 38 0 14 0 0 76 5 0 15 0 0 103 48 0 72 10 0 21 9 0 75 49 0 82 35 0 18 27 0 47 41 0 62 33 0 70 24 0 24 23 0 97 38 0 27 12 0 35 5 0 86 5 0 27 0 0 74 45 0 9 45 0 91 37 0 52 51 0 35 8 0 58 49 0 34 51 0 55 2 0 82 48...
output:
1
result:
ok single line: '1'
Test #29:
score: 0
Accepted
time: 35ms
memory: 12176kb
input:
186394 739549 11432 6186 174533 171315 7483 174533 171315 7484 174534 171315 7484 174534 171316 7484 174535 171316 7484 174535 171316 7485 174535 171315 7485 174536 171315 7485 174537 171315 7485 174538 171315 7485 174538 171316 7485 174538 171317 7485 174538 171317 7486 174538 171317 7487 174539 17...
output:
4
result:
ok single line: '4'
Test #30:
score: 0
Accepted
time: 0ms
memory: 5788kb
input:
209 153 19 517 104 138 18 101 137 16 108 140 16 103 141 18 111 132 11 108 133 16 100 136 17 108 131 18 107 128 18 102 131 13 109 135 17 106 132 17 115 131 18 100 139 15 109 134 13 106 135 16 109 134 17 103 126 18 108 131 16 99 129 17 97 132 14 104 140 18 104 136 13 100 132 11 109 136 18 108 128 17 1...
output:
3
result:
ok single line: '3'
Test #31:
score: 0
Accepted
time: 5ms
memory: 5828kb
input:
188531 10446 536 589 84274 2936 456 84274 2935 456 84274 2935 455 84274 2935 454 84274 2934 454 84274 2934 453 84274 2935 453 84274 2935 452 84274 2935 451 84273 2935 451 84272 2935 451 84272 2934 451 84272 2934 452 84273 2934 452 84273 2935 452 84272 2935 452 84272 2936 452 84273 2936 452 84273 293...
output:
1
result:
ok single line: '1'
Test #32:
score: 0
Accepted
time: 29ms
memory: 9412kb
input:
21053 199736 350764 4673 18382 68962 4571 18335 68978 4529 18371 68961 4573 18367 68945 4583 18328 68994 4510 18375 68991 4543 18388 68948 4590 18336 68999 4529 18309 69004 4533 18399 68960 4596 18400 68961 4616 18384 68964 4588 18301 68995 4519 18377 68957 4576 18389 68951 4604 18377 68954 4592 183...
output:
3
result:
ok single line: '3'
Test #33:
score: 0
Accepted
time: 0ms
memory: 5912kb
input:
15 571 4057 855 4 179 3376 5 179 3376 5 179 3377 5 180 3377 4 180 3377 4 180 3376 4 180 3375 3 180 3375 3 181 3375 4 181 3375 5 181 3375 5 182 3375 5 182 3376 6 182 3376 6 182 3375 6 183 3375 6 183 3376 5 183 3376 4 183 3376 3 183 3376 2 183 3376 2 183 3377 3 183 3377 3 184 3377 4 184 3377 4 184 337...
output:
2
result:
ok single line: '2'
Test #34:
score: 0
Accepted
time: 24ms
memory: 8656kb
input:
370434 96693 82661 3747 166785 73707 82231 166791 73719 82208 166795 73747 82189 166778 73724 82238 166784 73780 82247 166776 73711 82234 166788 73740 82245 166787 73770 82253 166778 73716 82230 166794 73743 82193 166802 73749 82246 166799 73758 82173 166769 73734 82262 166789 73735 82191 166784 737...
output:
1
result:
ok single line: '1'
Test #35:
score: 0
Accepted
time: 6ms
memory: 5848kb
input:
10361 32 1393 864 1486 28 676 1486 28 677 1485 28 677 1484 28 677 1484 28 676 1483 28 676 1483 29 676 1482 29 676 1482 30 676 1482 30 677 1483 30 677 1483 29 677 1483 28 677 1483 27 677 1483 26 677 1483 25 677 1484 25 677 1485 25 677 1485 25 678 1485 26 678 1484 26 678 1484 26 679 1484 27 679 1484 2...
output:
1
result:
ok single line: '1'
Test #36:
score: 0
Accepted
time: 6ms
memory: 6120kb
input:
247881 2343 25490 784 81260 1758 4758 81277 1770 4761 81261 1758 4752 81282 1768 4759 81270 1760 4763 81271 1769 4756 81307 1770 4774 81264 1762 4760 81274 1764 4760 81295 1768 4771 81291 1765 4771 81298 1754 4761 81293 1767 4777 81263 1753 4754 81279 1768 4766 81305 1760 4764 81267 1763 4762 81304 ...
output:
1
result:
ok single line: '1'
Test #37:
score: 0
Accepted
time: 0ms
memory: 5652kb
input:
259472 5598 5181 62 119917 1186 4230 119918 1186 4230 119918 1186 4229 119918 1185 4229 119918 1185 4228 119917 1185 4228 119916 1185 4228 119915 1185 4228 119914 1185 4228 119914 1185 4229 119914 1186 4229 119913 1186 4229 119913 1186 4230 119913 1187 4230 119913 1187 4231 119914 1187 4231 119914 1...
output:
1
result:
ok single line: '1'
Test #38:
score: 0
Accepted
time: 15ms
memory: 8144kb
input:
404500 33707 35 2611 215070 23253 19 215067 23269 34 215064 23272 34 215071 23253 12 215055 23256 9 215067 23258 22 215055 23273 6 215064 23267 15 215073 23252 26 215043 23261 1 215068 23268 23 215059 23283 33 215079 23266 26 215066 23278 19 215069 23254 18 215050 23272 2 215059 23260 22 215059 2327...
output:
3
result:
ok single line: '3'
Test #39:
score: 0
Accepted
time: 586ms
memory: 64488kb
input:
20000 20000 20000 20000 19261 4059 5655 17742 7146 16133 16432 6879 7176 11583 15217 219 887 10507 12485 5835 6676 5266 8731 14244 15558 3472 18487 1339 7207 10835 14210 12267 17325 4180 14809 13561 12746 19392 437 19093 12869 18953 13585 3523 7489 12369 3659 3702 697 10030 12759 2599 10733 4166 917...
output:
1
result:
ok single line: '1'
Test #40:
score: 0
Accepted
time: 502ms
memory: 53372kb
input:
5995 6428 12040 18317 4478 5315 8758 3587 29 7652 2451 5216 1869 3252 1610 11021 13 2799 6735 3956 4504 6103 2607 5494 8006 2775 4260 8206 3338 4035 11252 1112 1926 7065 3121 5928 5147 1718 4461 9300 42 5492 4298 326 6170 3603 1208 889 9380 2383 2890 7050 4067 3798 11298 3164 4049 5184 5521 3856 818...
output:
1
result:
ok single line: '1'
Test #41:
score: 0
Accepted
time: 453ms
memory: 45252kb
input:
5469 2509 4753 17289 5193 464 767 1964 120 2243 2444 1325 229 3655 1557 1197 1197 693 1494 2366 795 3415 1207 2476 2799 617 1326 898 964 1627 2648 802 105 4692 2341 2198 2133 2764 216 609 4244 1496 3371 4848 240 1548 2056 2266 194 2742 1599 2055 2933 1968 4180 2828 73 3134 1405 2367 4161 2901 277 34...
output:
1
result:
ok single line: '1'
Test #42:
score: 0
Accepted
time: 419ms
memory: 48420kb
input:
6212 13843 3312 16104 2745 7833 2938 3943 10232 409 3204 4086 161 918 9601 109 4632 12280 2426 4692 8747 2089 2104 484 1277 3075 8922 2265 274 13736 290 692 1771 613 583 1977 2577 5252 12752 2790 56 11866 2785 440 9759 1282 3013 9202 2677 5561 9088 2431 5622 10788 89 4559 11644 549 1590 3893 1118 10...
output:
1
result:
ok single line: '1'
Test #43:
score: 0
Accepted
time: 269ms
memory: 33340kb
input:
1824 4142 5965 10476 1256 1046 1712 1575 10 4286 1463 3992 992 1662 1411 3036 435 3834 3581 295 2530 1920 1546 1559 5921 939 2280 1088 1628 1555 3950 440 843 5257 753 68 1116 1312 2681 3051 1557 925 5912 1458 1732 4263 1078 3122 1347 572 4121 4911 88 87 3746 73 4097 1319 1503 3161 4765 221 1542 5926...
output:
1
result:
ok single line: '1'
Test #44:
score: 0
Accepted
time: 559ms
memory: 61720kb
input:
977521 289001 306415 20000 31680 171802 85569 156151 165694 3316 110462 120590 205137 238416 241985 136527 798665 246701 145443 116669 2826 139954 26965 52112 269902 25983 25290 12610 924812 115016 185124 405983 247955 5459 336725 234707 108713 405176 222639 170943 909776 175160 104708 252730 192603...
output:
1
result:
ok single line: '1'
Test #45:
score: 0
Accepted
time: 587ms
memory: 65068kb
input:
627313 253786 507828 20000 472375 87937 135262 469716 189678 157623 263690 67226 123559 151239 151834 68299 215710 133223 325065 517209 90864 293450 191363 13750 280648 622076 94022 116968 211203 175560 379132 177839 216577 242325 604171 7951 293158 51706 94248 90369 165983 136985 310772 143874 2524...
output:
1
result:
ok single line: '1'
Test #46:
score: 0
Accepted
time: 1ms
memory: 5680kb
input:
2 1 3 4 1 0 0 0 0 2 0 0 1 0 0 0
output:
1
result:
ok single line: '1'
Test #47:
score: 0
Accepted
time: 1ms
memory: 5680kb
input:
3 3 1 4 0 0 0 2 1 0 1 2 0 0 2 0
output:
2
result:
ok single line: '2'
Test #48:
score: 0
Accepted
time: 0ms
memory: 5680kb
input:
2 1 2 3 0 0 1 1 0 0 1 0 1
output:
1
result:
ok single line: '1'
Test #49:
score: 0
Accepted
time: 0ms
memory: 5912kb
input:
2 2 2 1 0 0 1
output:
1
result:
ok single line: '1'
Test #50:
score: 0
Accepted
time: 1ms
memory: 5672kb
input:
2 2 2 4 1 0 1 0 0 0 1 1 1 0 1 1
output:
2
result:
ok single line: '2'
Test #51:
score: 0
Accepted
time: 43ms
memory: 16976kb
input:
1 1 40001 20000 0 0 1 0 0 3 0 0 5 0 0 7 0 0 9 0 0 11 0 0 13 0 0 15 0 0 17 0 0 19 0 0 21 0 0 23 0 0 25 0 0 27 0 0 29 0 0 31 0 0 33 0 0 35 0 0 37 0 0 39 0 0 41 0 0 43 0 0 45 0 0 47 0 0 49 0 0 51 0 0 53 0 0 55 0 0 57 0 0 59 0 0 61 0 0 63 0 0 65 0 0 67 0 0 69 0 0 71 0 0 73 0 0 75 0 0 77 0 0 79 0 0 81 0 ...
output:
20001
result:
ok single line: '20001'
Test #52:
score: 0
Accepted
time: 90ms
memory: 28980kb
input:
34 34 35 20000 0 0 0 0 2 0 0 4 0 0 6 0 0 8 0 0 10 0 0 12 0 0 14 0 0 16 0 0 18 0 0 20 0 0 22 0 0 24 0 0 26 0 0 28 0 0 30 0 0 32 0 1 1 0 1 3 0 1 5 0 1 7 0 1 9 0 1 11 0 1 13 0 1 15 0 1 17 0 1 19 0 1 21 0 1 23 0 1 25 0 1 27 0 1 29 0 1 31 0 1 33 0 2 0 0 2 2 0 2 4 0 2 6 0 2 8 0 2 10 0 2 12 0 2 14 0 2 16 0...
output:
19754
result:
ok single line: '19754'
Test #53:
score: 0
Accepted
time: 110ms
memory: 32040kb
input:
2014 1 6918 16207 1710 0 912 1176 0 85 1574 0 5676 1539 0 867 1783 0 6360 522 0 6334 1533 0 4052 1914 0 5652 777 0 6183 1393 0 1684 103 0 2272 1719 0 3486 59 0 2228 988 0 5429 1756 0 4632 525 0 6335 873 0 534 946 0 1287 547 0 5125 445 0 2845 1734 0 6355 646 0 3703 912 0 2718 1736 0 3709 1901 0 531 1...
output:
1
result:
ok single line: '1'
Test #54:
score: 0
Accepted
time: 93ms
memory: 23672kb
input:
115 1 125659 10932 38 0 29817 93 0 9457 11 0 305 109 0 61855 16 0 49522 59 0 77815 65 0 86039 20 0 115236 33 0 109994 34 0 84600 57 0 57336 49 0 92739 18 0 114441 2 0 119646 20 0 75575 81 0 28776 83 0 104815 75 0 42499 34 0 100843 59 0 15571 90 0 30063 67 0 64642 17 0 40044 10 0 56481 51 0 2596 71 0...
output:
1
result:
ok single line: '1'
Test #55:
score: 0
Accepted
time: 3ms
memory: 5972kb
input:
134 18 1 607 63 15 0 70 6 0 2 17 0 129 15 0 128 2 0 17 17 0 21 11 0 86 12 0 43 2 0 16 12 0 98 6 0 42 13 0 54 4 0 49 15 0 78 4 0 37 6 0 69 14 0 132 5 0 37 8 0 56 9 0 33 6 0 111 9 0 3 4 0 126 10 0 59 16 0 4 13 0 13 2 0 92 16 0 67 12 0 124 15 0 102 7 0 10 3 0 99 4 0 130 4 0 29 8 0 105 8 0 119 13 0 53 1...
output:
13
result:
ok single line: '13'
Test #56:
score: 0
Accepted
time: 95ms
memory: 24972kb
input:
1 23709 22560 9777 0 22129 20023 0 9730 9772 0 20747 11372 0 14499 21848 0 13702 2589 0 14451 17854 0 19265 20671 0 19117 15281 0 21040 20597 0 6183 21609 0 16503 8922 0 9878 8851 0 12166 379 0 1827 4636 0 18801 17020 0 4788 12339 0 20151 6593 0 2611 6314 0 5741 7713 0 20701 7185 0 12408 9796 0 2264...
output:
1
result:
ok single line: '1'
Test #57:
score: 0
Accepted
time: 59ms
memory: 19016kb
input:
95 1 12523 7777 59 0 3829 2 0 630 39 0 7074 71 0 8109 76 0 9137 21 0 5233 91 0 5073 45 0 3806 26 0 11146 47 0 265 79 0 284 91 0 10624 11 0 5023 94 0 12368 29 0 2675 50 0 11633 59 0 9812 88 0 10317 84 0 4745 61 0 6533 55 0 9883 62 0 2728 87 0 8292 11 0 10377 24 0 698 32 0 4633 45 0 4208 74 0 5225 30 ...
output:
1
result:
ok single line: '1'
Test #58:
score: 0
Accepted
time: 1ms
memory: 5692kb
input:
62 1 1 20 26 0 0 58 0 0 31 0 0 33 0 0 56 0 0 11 0 0 3 0 0 34 0 0 37 0 0 10 0 0 1 0 0 32 0 0 51 0 0 47 0 0 18 0 0 35 0 0 43 0 0 40 0 0 6 0 0 28 0 0
output:
16
result:
ok single line: '16'
Test #59:
score: 0
Accepted
time: 0ms
memory: 5968kb
input:
1 1 118 117 0 0 94 0 0 84 0 0 12 0 0 107 0 0 71 0 0 113 0 0 88 0 0 73 0 0 39 0 0 77 0 0 65 0 0 34 0 0 87 0 0 15 0 0 18 0 0 52 0 0 42 0 0 29 0 0 3 0 0 30 0 0 60 0 0 46 0 0 56 0 0 110 0 0 103 0 0 11 0 0 101 0 0 50 0 0 80 0 0 28 0 0 53 0 0 7 0 0 25 0 0 19 0 0 1 0 0 9 0 0 96 0 0 76 0 0 45 0 0 75 0 0 81 ...
output:
1
result:
ok single line: '1'
Test #60:
score: 0
Accepted
time: 8ms
memory: 7236kb
input:
71547 1 1 2821 19606 0 0 1998 0 0 12618 0 0 65804 0 0 14062 0 0 32647 0 0 19436 0 0 29232 0 0 58375 0 0 37702 0 0 51827 0 0 64347 0 0 66027 0 0 41928 0 0 18224 0 0 47420 0 0 64713 0 0 55117 0 0 66534 0 0 20851 0 0 54843 0 0 13429 0 0 15592 0 0 68228 0 0 69038 0 0 7713 0 0 53464 0 0 51468 0 0 67217 0...
output:
2720
result:
ok single line: '2720'
Test #61:
score: 0
Accepted
time: 53ms
memory: 17312kb
input:
1 1 844972 17257 0 0 487550 0 0 654334 0 0 379956 0 0 393661 0 0 412238 0 0 538745 0 0 69028 0 0 150105 0 0 160708 0 0 716004 0 0 116325 0 0 653001 0 0 262938 0 0 426594 0 0 667071 0 0 397408 0 0 308303 0 0 217936 0 0 819602 0 0 180124 0 0 633383 0 0 724092 0 0 129074 0 0 591196 0 0 368335 0 0 48803...
output:
16909
result:
ok single line: '16909'
Test #62:
score: 0
Accepted
time: 0ms
memory: 5632kb
input:
4 1 1 2 2 0 0 0 0 0
output:
2
result:
ok single line: '2'
Test #63:
score: 0
Accepted
time: 144ms
memory: 19172kb
input:
523 575 438 7772 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 37 0 0 38 0 0 39 0 0 40 0 0 41 0 0...
output:
1
result:
ok single line: '1'
Test #64:
score: 0
Accepted
time: 305ms
memory: 35384kb
input:
140 118 452 19360 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 37 0 0 38 0 0 39 0 0 40 0 0 41 0 ...
output:
1
result:
ok single line: '1'
Test #65:
score: 0
Accepted
time: 1ms
memory: 5880kb
input:
325 63191 114 0
output:
1
result:
ok single line: '1'
Test #66:
score: 0
Accepted
time: 1ms
memory: 5612kb
input:
1 757 336 0
output:
1
result:
ok single line: '1'