QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#794565#1799. SixpackI_be_wannaAC ✓43ms4736kbC++201.3kb2024-11-30 14:57:082024-11-30 14:57:14

Judging History

你现在查看的是最新测评结果

  • [2024-11-30 14:57:14]
  • 评测
  • 测评结果:AC
  • 用时:43ms
  • 内存:4736kb
  • [2024-11-30 14:57:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
#define ll long long
const ll mod=1e9+7;
ll cas[3][40];
int mp[N][2];
int main()
{
    for(int i=0;i<=9;i++)
        cas[1][i]=1;
    for(int i=0;i<=18;i++)
        for(int k=0;k<=min(9,i);k++)
            cas[2][i]+=cas[1][i-k];
    cas[0][0]=1;
    int n,k,m;
    scanf("%d%d%d",&n,&k,&m);
    int x,y,v;
    memset(mp,-1,sizeof(mp));
    for(int i=1;i<=m;i++)
        scanf("%d%d%d",&x,&y,&v),mp[x][y]=v;
    int val[3];
    ll ans=0;
    for(val[0]=0;val[0]<=min(18,k);val[0]++){
        for(val[1]=0;val[1]<=min(18,k-val[0]);val[1]++){
            val[2]=k-val[0]-val[1];
            if(val[2]>=0&&val[2]<=18){
                ll ret=1;
                for(int i=0;i<n;i++){
                    int sum=0,num=0;
                    sum+=mp[i][0]==-1?0:mp[i][0];
                    sum+=mp[i][1]==-1?0:mp[i][1];
                    num+=mp[i][0]==-1?0:1;
                    num+=mp[i][1]==-1?0:1;
                    if(sum>val[i%3])
                        ret=0;
                    ret=ret*cas[2-num][val[i%3]-sum]%mod;
                    if(!ret)
                        break;
                }
                ans=(ans+ret)%mod;
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}


详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 4584kb

input:

16666 2 2
8742 0 2
8742 1 0

output:

51748587

result:

ok single line: '51748587'

Test #2:

score: 0
Accepted
time: 3ms
memory: 4616kb

input:

16666 27 16666
4869 1 1
5612 0 4
3587 1 1
13186 0 0
13660 0 2
8203 1 0
9914 0 8
4808 0 6
2714 0 2
10636 0 1
8598 0 5
3602 0 3
16325 1 4
46 0 1
5357 1 0
11935 1 1
482 0 2
3241 1 5
8403 1 0
5726 0 9
11584 0 2
3718 0 6
7445 1 8
1969 1 4
12281 1 3
15580 0 4
16349 1 8
5658 0 3
1635 1 8
2303 1 1
12218 0 2...

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 4ms
memory: 4664kb

input:

16666 5 31653
5027 0 1
7820 1 9
2062 0 7
8081 0 5
16165 0 2
667 0 6
14695 1 9
6187 0 9
8256 0 8
4063 0 1
4035 1 0
5379 0 9
13342 1 7
5377 1 7
7638 1 2
3909 0 2
8713 1 9
13917 1 0
8293 1 3
15591 1 5
15154 0 2
3773 0 6
3392 1 9
10437 0 2
14501 0 4
7442 1 5
3732 1 8
422 0 2
5831 1 2
7127 0 7
7527 1 2
3...

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 0ms
memory: 4548kb

input:

16666 54 4469
7751 1 9
9140 1 9
4522 1 9
8422 0 9
14859 1 9
600 1 9
12613 0 9
9501 1 9
336 1 9
4814 0 9
1812 0 9
14133 0 9
10574 0 9
6384 0 9
4835 1 9
8125 0 9
9272 0 9
511 0 9
13400 0 9
1475 1 9
2316 0 9
2766 1 9
1888 0 9
10408 1 9
775 1 9
1994 1 9
2171 0 9
5671 0 9
3659 1 9
1620 0 9
8244 0 9
11647...

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 2ms
memory: 4680kb

input:

16666 11 4
1217 0 6
6958 0 8
13016 1 7
13014 0 5

output:

0

result:

ok single line: '0'

Test #6:

score: 0
Accepted
time: 2ms
memory: 4608kb

input:

16666 33 33332
2697 1 8
12221 1 7
215 1 4
13486 1 1
12229 0 0
15355 1 5
6381 1 2
3006 0 5
8496 0 6
7896 0 6
612 0 5
3709 0 5
9795 0 8
13885 0 2
8790 0 2
6345 1 1
6306 0 8
16124 1 1
15756 1 2
9287 1 5
11298 0 5
12779 0 0
4183 0 1
14264 1 2
12277 0 4
4644 1 1
9544 1 3
10528 0 5
14707 1 9
4442 0 4
3349...

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 2ms
memory: 4540kb

input:

33332 3 2
31592 1 0
31592 0 3

output:

123269456

result:

ok single line: '123269456'

Test #8:

score: 0
Accepted
time: 5ms
memory: 4684kb

input:

33332 27 33332
20705 0 9
8347 0 2
17682 1 6
28161 0 9
6553 0 0
29839 0 9
18802 1 3
22282 1 1
13066 1 2
18349 0 5
3270 1 7
13385 0 7
4778 1 0
12979 0 3
4517 0 8
21605 0 7
23117 0 6
12724 1 6
26726 1 5
33076 1 9
3837 0 0
24743 0 3
18232 1 7
27451 0 2
16305 0 5
8100 1 8
1753 0 6
4667 0 7
25829 0 6
3146...

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 7ms
memory: 4544kb

input:

33332 2 51748
24924 0 8
17953 1 8
16253 1 4
19092 0 2
16047 1 7
2098 0 9
8510 1 0
29906 0 7
25226 1 0
2551 0 6
13525 1 1
32484 1 7
21104 0 6
6421 0 0
9251 1 0
10182 1 3
9909 1 6
4402 0 6
11109 0 5
2094 0 2
14752 0 5
12662 1 9
30293 1 8
16066 0 4
8834 1 7
29775 1 9
16179 0 1
6003 0 2
12370 0 3
15643 ...

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 1ms
memory: 4692kb

input:

33332 54 5300
13809 0 9
5126 0 9
18111 1 9
12740 0 9
20941 0 9
24877 1 9
11235 0 9
25825 1 9
13786 1 9
11945 0 9
13193 0 9
12963 1 9
4649 1 9
6042 0 9
3421 0 9
3527 1 9
28066 0 9
10371 0 9
27852 1 9
19988 1 9
9910 0 9
232 0 9
7445 0 9
21700 0 9
5942 0 9
10042 1 9
1829 1 9
11800 0 9
11751 0 9
32826 0...

output:

1

result:

ok single line: '1'

Test #11:

score: 0
Accepted
time: 2ms
memory: 4588kb

input:

33332 45 6
22223 0 1
22224 1 5
6559 1 2
6561 0 9
7244 1 3
7245 0 5

output:

0

result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 8ms
memory: 4620kb

input:

33332 48 66664
28163 0 2
17429 0 2
26478 0 1
30601 0 6
4202 0 7
2032 0 4
15014 0 5
15729 0 0
31737 0 7
1747 1 7
12943 1 8
192 0 2
33107 0 9
13825 1 8
32178 1 6
14623 0 7
27797 0 1
11158 0 3
10320 0 3
14916 1 5
3067 1 6
1122 1 1
30112 1 5
10816 0 0
7052 0 5
27912 1 8
29701 1 4
12637 0 4
21638 0 7
169...

output:

0

result:

ok single line: '0'

Test #13:

score: 0
Accepted
time: 8ms
memory: 4668kb

input:

49998 15 2
13531 0 8
13531 1 7

output:

790773257

result:

ok single line: '790773257'

Test #14:

score: 0
Accepted
time: 7ms
memory: 4592kb

input:

49998 27 49998
43576 1 5
21134 1 4
46009 0 4
30173 0 4
49641 0 6
24572 1 0
15041 0 1
41615 0 8
6197 0 2
13064 1 0
23351 0 9
7010 1 9
45575 0 6
37707 0 1
5054 1 5
13038 1 7
6101 0 8
34226 1 9
17725 0 8
16261 0 9
9064 1 7
27797 0 9
1570 1 5
21321 0 9
37504 1 0
32783 0 1
22122 1 8
28289 0 6
25447 0 6
1...

output:

1

result:

ok single line: '1'

Test #15:

score: 0
Accepted
time: 8ms
memory: 4544kb

input:

49998 35 63241
19307 1 1
32549 1 3
40122 1 1
26343 1 3
7496 1 0
10006 1 7
23979 1 6
11625 1 8
897 0 5
31598 0 6
36157 1 3
20015 0 1
18241 1 9
23767 0 5
49287 1 1
27731 0 0
17817 0 2
1367 0 5
20014 1 8
22189 0 0
21801 0 7
44667 1 8
11210 0 5
11851 1 8
19249 0 7
21101 1 3
45036 1 9
12933 0 5
7325 0 5
...

output:

0

result:

ok single line: '0'

Test #16:

score: 0
Accepted
time: 1ms
memory: 4524kb

input:

49998 0 5015
49036 1 0
14319 1 0
15574 0 0
1467 0 0
1645 0 0
39302 1 0
20503 0 0
23979 1 0
29900 0 0
29448 0 0
43613 1 0
31083 1 0
24301 0 0
4910 1 0
5105 0 0
11222 0 0
48760 1 0
19990 1 0
14894 1 0
17345 1 0
37795 0 0
26117 0 0
7118 1 0
20366 0 0
47184 1 0
34194 1 0
15534 0 0
17404 0 0
45810 0 0
48...

output:

1

result:

ok single line: '1'

Test #17:

score: 0
Accepted
time: 8ms
memory: 4616kb

input:

49998 30 12
9941 1 2
7045 1 9
9940 0 7
9942 1 7
9940 1 9
7044 1 6
7045 0 9
11800 1 4
11801 0 8
11802 0 6
7044 0 8
11801 1 0

output:

0

result:

ok single line: '0'

Test #18:

score: 0
Accepted
time: 12ms
memory: 4688kb

input:

49998 39 99996
42501 0 0
137 1 7
37792 1 2
36776 0 5
46058 1 8
29291 0 1
43984 0 7
17337 0 2
20653 0 7
12584 0 8
2609 0 2
3360 0 0
34713 0 7
34878 0 3
10961 0 6
40954 0 5
9871 1 6
20907 1 6
39704 1 0
33825 1 8
31220 0 0
25411 1 6
1559 0 6
45073 1 1
13897 0 0
10145 1 2
45535 1 5
3296 1 5
21199 0 7
27...

output:

0

result:

ok single line: '0'

Test #19:

score: 0
Accepted
time: 8ms
memory: 4668kb

input:

66664 12 2
18942 1 3
18942 0 9

output:

222803950

result:

ok single line: '222803950'

Test #20:

score: 0
Accepted
time: 9ms
memory: 4608kb

input:

66664 27 66664
24659 0 1
63400 1 3
43181 0 9
26442 1 4
12882 1 8
21238 1 9
3606 1 3
13428 1 2
10445 0 4
13404 1 7
57277 0 5
59056 1 4
39117 0 8
42254 1 3
13191 0 2
9262 1 3
33773 0 2
47746 1 4
5211 0 0
3941 0 4
11682 1 6
47743 0 8
25163 0 0
26167 0 6
62307 0 0
30538 1 7
52943 0 6
66640 1 1
54916 1 3...

output:

1

result:

ok single line: '1'

Test #21:

score: 0
Accepted
time: 9ms
memory: 4668kb

input:

66664 22 70323
7980 1 9
57089 0 8
34275 1 1
60209 1 5
65541 0 7
35339 1 4
20581 1 7
49977 1 9
22507 0 4
23276 1 2
24590 1 5
11063 1 2
1715 1 5
3063 0 2
18927 0 8
61903 0 4
32920 0 6
31212 0 9
28013 0 5
16608 1 2
14738 1 7
37288 0 8
53438 0 3
17428 0 8
29097 0 8
9800 1 7
39877 0 6
47740 1 8
267 0 3
2...

output:

0

result:

ok single line: '0'

Test #22:

score: 0
Accepted
time: 0ms
memory: 4620kb

input:

66664 54 7376
28647 0 9
37299 1 9
1397 0 9
40138 0 9
39672 1 9
62864 1 9
25014 0 9
26721 1 9
7391 1 9
2513 1 9
45863 1 9
37698 0 9
49327 0 9
8358 0 9
57574 0 9
11803 1 9
45013 0 9
41784 0 9
65695 0 9
66046 1 9
57423 0 9
52127 1 9
44399 1 9
48065 1 9
62003 1 9
18065 0 9
14520 1 9
3306 1 9
12856 0 9
3...

output:

1

result:

ok single line: '1'

Test #23:

score: 0
Accepted
time: 26ms
memory: 4652kb

input:

66664 29 11
46828 0 4
46826 1 5
53546 1 9
46828 1 6
53544 1 6
53545 1 2
23163 1 0
23163 0 1
46826 0 1
23162 0 9
23162 1 1

output:

0

result:

ok single line: '0'

Test #24:

score: 0
Accepted
time: 16ms
memory: 4624kb

input:

66664 44 133328
28155 0 7
22410 0 8
19928 1 1
38391 0 4
28184 0 8
64612 1 0
36609 0 1
36293 0 2
47648 1 7
19129 0 2
64243 1 0
22815 0 4
6264 0 5
41814 1 1
19898 0 1
28259 1 2
32549 0 4
16997 0 4
43666 0 2
39863 0 5
1230 1 5
48263 1 7
35110 0 8
13346 0 9
15239 0 0
29351 1 5
22115 1 9
18339 1 4
42563 ...

output:

0

result:

ok single line: '0'

Test #25:

score: 0
Accepted
time: 8ms
memory: 4680kb

input:

83330 6 2
58943 0 1
58943 1 5

output:

531145528

result:

ok single line: '531145528'

Test #26:

score: 0
Accepted
time: 11ms
memory: 4668kb

input:

83330 27 83330
63453 0 2
41092 1 1
14509 0 0
23929 0 2
22781 0 2
68685 0 6
20528 1 6
40517 0 8
3597 0 4
56688 1 4
56596 1 1
67980 1 9
13856 1 4
33944 1 6
8214 1 7
75499 0 3
996 1 8
44857 0 8
19921 0 0
38185 0 2
4195 0 9
17548 1 8
33081 0 8
55554 1 0
80145 0 0
70983 0 6
2665 0 9
46935 0 0
56175 0 8
6...

output:

1

result:

ok single line: '1'

Test #27:

score: 0
Accepted
time: 9ms
memory: 4736kb

input:

83330 13 75037
1238 0 7
17666 0 0
50178 1 1
17473 0 1
79380 1 9
55059 0 7
67250 1 4
22298 1 3
69396 1 1
79476 1 3
78354 1 0
19911 1 8
25456 1 1
65191 1 1
72382 1 5
74960 0 5
5155 0 6
23908 0 0
49733 1 5
20104 0 8
53143 0 2
14675 1 9
53811 0 0
20968 1 0
35741 0 5
39297 0 6
65003 1 3
10032 1 4
53257 1...

output:

0

result:

ok single line: '0'

Test #28:

score: 0
Accepted
time: 1ms
memory: 4676kb

input:

83330 54 2971
48176 0 9
52917 1 9
11294 1 9
41484 1 9
19798 0 9
39461 1 9
53433 1 9
2322 0 9
57474 1 9
34518 1 9
1085 1 9
48595 1 9
3161 1 9
76326 0 9
65900 0 9
4446 1 9
43754 1 9
28475 0 9
42656 0 9
60158 0 9
42875 0 9
48407 0 9
75294 1 9
67222 1 9
75421 1 9
20986 1 9
18382 1 9
13119 0 9
23357 1 9
...

output:

1

result:

ok single line: '1'

Test #29:

score: 0
Accepted
time: 6ms
memory: 4680kb

input:

83330 6 7
48210 1 5
43298 1 0
48210 0 1
43300 0 1
43298 0 8
43300 1 2
54997 0 6

output:

0

result:

ok single line: '0'

Test #30:

score: 0
Accepted
time: 20ms
memory: 4684kb

input:

83330 50 166660
58408 1 9
71813 0 3
73512 1 1
45951 0 6
32816 1 6
45316 0 8
69084 1 0
55784 1 5
64458 0 6
75752 0 3
19646 1 8
73504 0 1
27431 1 9
33364 0 4
78802 1 8
25810 1 1
3646 0 9
39194 1 0
16181 0 2
56690 0 6
69411 1 5
82614 1 7
8129 1 2
70931 0 4
65492 1 2
33121 0 9
58156 1 8
18178 0 9
64931 ...

output:

0

result:

ok single line: '0'

Test #31:

score: 0
Accepted
time: 33ms
memory: 4620kb

input:

99996 13 2
74785 1 8
74785 0 5

output:

744270294

result:

ok single line: '744270294'

Test #32:

score: 0
Accepted
time: 13ms
memory: 4728kb

input:

99996 27 99996
64534 1 1
92544 1 0
87704 1 7
28013 0 1
56787 0 3
56766 1 4
86459 0 0
88522 1 4
98564 1 9
2533 0 2
76642 1 9
25518 1 0
77283 0 9
67757 0 5
73068 1 3
77941 0 1
7549 0 3
41687 0 8
48483 0 1
4875 0 2
51969 0 3
31946 1 1
98972 1 7
94911 0 6
34837 0 5
18116 1 7
94645 0 9
92390 1 8
56 1 2
8...

output:

1

result:

ok single line: '1'

Test #33:

score: 0
Accepted
time: 10ms
memory: 4616kb

input:

99996 16 78588
4935 1 5
90118 0 3
37903 0 4
22391 1 2
78518 1 6
19944 1 1
16654 0 2
29705 0 6
4250 0 4
81478 1 2
14290 1 7
4599 0 0
64177 1 4
84487 0 8
9630 1 6
2566 1 2
94399 0 8
24929 0 9
73048 0 3
15306 1 5
12469 1 7
79982 0 6
51320 0 5
34986 1 2
17328 0 4
26784 1 7
62338 0 2
92163 1 0
39727 1 0
...

output:

0

result:

ok single line: '0'

Test #34:

score: 0
Accepted
time: 2ms
memory: 4728kb

input:

99996 54 10130
55170 1 9
67304 1 9
16539 1 9
20596 1 9
97542 0 9
25196 1 9
92269 1 9
40355 1 9
94537 1 9
9773 1 9
30443 1 9
21706 0 9
60717 1 9
67493 1 9
96224 1 9
16968 1 9
23178 1 9
7011 0 9
7097 1 9
96807 1 9
46471 1 9
87017 0 9
69750 0 9
1100 1 9
57219 1 9
31440 0 9
40178 1 9
7125 1 9
41701 1 9
...

output:

1

result:

ok single line: '1'

Test #35:

score: 0
Accepted
time: 22ms
memory: 4732kb

input:

99996 35 8
43241 1 0
61963 1 2
43240 1 4
24837 0 7
61962 1 5
24838 0 0
24836 0 2
43241 0 8

output:

0

result:

ok single line: '0'

Test #36:

score: 0
Accepted
time: 24ms
memory: 4684kb

input:

99996 43 199992
81183 1 6
87926 0 3
26930 0 3
94917 0 4
94083 1 9
86506 0 5
35662 0 5
36999 1 5
30296 0 7
24380 0 9
43727 1 2
18899 0 1
64343 0 4
4632 1 8
18729 0 6
30865 1 2
46854 0 4
85754 0 9
1507 0 0
13658 0 3
64676 1 7
29334 1 7
98731 0 2
85359 0 2
61113 1 0
73202 0 2
57901 0 7
51308 0 4
77244 ...

output:

0

result:

ok single line: '0'

Test #37:

score: 0
Accepted
time: 1ms
memory: 4684kb

input:

3 14 2
1 0 6
1 1 8

output:

1

result:

ok single line: '1'

Test #38:

score: 0
Accepted
time: 1ms
memory: 4580kb

input:

5 15 2
4 0 7
4 1 8

output:

4

result:

ok single line: '4'

Test #39:

score: 0
Accepted
time: 1ms
memory: 4688kb

input:

17 9 2
4 0 7
4 1 2

output:

100000

result:

ok single line: '100000'

Test #40:

score: 0
Accepted
time: 0ms
memory: 4680kb

input:

353 7 2
192 1 2
192 0 5

output:

867243987

result:

ok single line: '867243987'

Test #41:

score: 0
Accepted
time: 2ms
memory: 4728kb

input:

17568 17 2
5763 0 8
5763 1 9

output:

855838472

result:

ok single line: '855838472'

Test #42:

score: 0
Accepted
time: 43ms
memory: 4592kb

input:

99999 15 2
76014 1 7
76014 0 8

output:

746106753

result:

ok single line: '746106753'

Test #43:

score: 0
Accepted
time: 5ms
memory: 4728kb

input:

100000 8 2
19497 1 0
19497 0 8

output:

851618428

result:

ok single line: '851618428'

Test #44:

score: 0
Accepted
time: 1ms
memory: 4684kb

input:

3 27 3
2 1 0
0 1 1
1 0 5

output:

28

result:

ok single line: '28'

Test #45:

score: 0
Accepted
time: 1ms
memory: 4676kb

input:

5 27 5
4 1 4
0 1 7
3 0 4
1 0 2
2 1 2

output:

41

result:

ok single line: '41'

Test #46:

score: 0
Accepted
time: 1ms
memory: 4584kb

input:

17 27 17
13 1 5
2 0 3
0 0 2
15 1 6
14 0 3
5 1 9
3 1 8
9 1 8
4 0 1
8 0 0
11 1 7
1 1 0
10 0 4
7 1 7
12 0 1
6 0 8
16 0 2

output:

2

result:

ok single line: '2'

Test #47:

score: 0
Accepted
time: 1ms
memory: 4596kb

input:

353 27 353
67 1 3
212 0 3
127 1 8
1 1 2
272 0 1
105 1 9
50 0 8
194 0 3
95 1 9
58 0 3
54 0 0
251 1 8
191 1 2
255 1 3
102 0 6
298 0 9
41 1 2
155 1 7
163 1 6
274 0 2
291 1 3
164 0 0
181 1 2
193 1 9
25 1 7
189 1 3
217 1 0
136 0 2
296 0 6
148 0 6
325 1 5
287 1 5
253 1 4
29 1 6
285 1 4
302 0 7
57 1 3
252 ...

output:

1

result:

ok single line: '1'

Test #48:

score: 0
Accepted
time: 3ms
memory: 4728kb

input:

17568 27 17568
14498 0 7
9736 0 7
7236 0 4
123 1 3
11824 0 1
12282 0 1
4990 0 6
13351 1 5
14274 0 3
9361 1 9
5922 0 4
17523 1 1
1185 1 0
1132 0 7
8909 1 0
7807 1 1
4639 1 0
7412 0 6
11362 0 3
2913 1 2
9468 0 1
2029 1 4
10969 1 4
104 0 0
10869 1 2
7349 1 5
15245 1 9
1779 1 9
13527 1 6
4752 0 2
10334 ...

output:

1

result:

ok single line: '1'

Test #49:

score: 0
Accepted
time: 13ms
memory: 4676kb

input:

99999 27 99999
59192 0 7
3626 0 2
32649 1 7
45909 1 3
82890 0 3
1817 1 0
60380 0 4
32539 1 3
63798 0 7
28089 1 4
34930 0 1
90261 1 2
94895 1 4
59861 1 5
26900 0 8
62595 1 2
45611 1 0
16036 0 7
15355 1 8
59693 1 9
42727 1 2
83780 0 4
33435 1 6
36606 0 4
31335 1 5
17843 1 0
27732 0 3
84827 1 6
99974 0...

output:

1

result:

ok single line: '1'

Test #50:

score: 0
Accepted
time: 13ms
memory: 4724kb

input:

100000 27 100000
99370 1 7
52481 0 7
62271 0 8
56823 0 2
29164 1 4
74340 1 3
24489 0 2
34369 0 0
48480 1 0
8789 0 9
51965 0 5
16922 1 0
81365 0 0
98622 1 0
54834 1 2
78412 1 2
79496 1 3
33178 1 4
71362 1 2
18738 1 3
39455 0 3
21313 0 2
13550 1 6
92716 1 6
56670 1 5
6503 0 0
24752 1 3
33872 1 9
93844...

output:

1

result:

ok single line: '1'

Test #51:

score: 0
Accepted
time: 1ms
memory: 4676kb

input:

3 43 6
2 1 0
2 0 7
0 1 5
1 1 1
0 0 1
1 0 9

output:

0

result:

ok single line: '0'

Test #52:

score: 0
Accepted
time: 1ms
memory: 4668kb

input:

5 29 10
3 1 1
3 0 0
4 0 0
2 1 2
0 1 7
4 1 8
0 0 5
2 0 3
1 0 5
1 1 5

output:

0

result:

ok single line: '0'

Test #53:

score: 0
Accepted
time: 1ms
memory: 4584kb

input:

17 5 34
15 0 0
1 1 1
6 0 9
0 1 9
14 1 3
12 0 5
10 1 6
10 0 4
13 1 9
11 1 2
5 0 7
8 0 3
5 1 8
9 0 8
8 1 1
16 0 2
3 0 3
13 0 7
11 0 7
4 1 9
3 1 0
0 0 9
7 1 4
9 1 4
4 0 6
2 0 2
1 0 9
12 1 0
7 0 7
15 1 4
2 1 1
14 0 8
6 1 4
16 1 0

output:

0

result:

ok single line: '0'

Test #54:

score: 0
Accepted
time: 1ms
memory: 4704kb

input:

353 32 706
117 0 0
235 1 6
1 0 3
334 0 1
332 0 7
172 1 9
288 0 6
3 1 6
201 1 9
275 0 3
73 1 6
217 0 2
66 1 2
311 1 6
146 0 2
264 0 3
227 0 4
316 0 6
85 0 3
41 0 7
331 1 6
196 0 2
270 0 9
151 1 7
102 1 6
132 1 7
100 1 3
41 1 1
347 0 0
20 0 3
182 0 1
213 0 5
306 0 4
130 0 9
126 0 8
105 0 4
21 0 4
239 ...

output:

0

result:

ok single line: '0'

Test #55:

score: 0
Accepted
time: 5ms
memory: 4732kb

input:

17568 18 33098
12379 1 9
11313 1 8
6743 1 1
13759 0 6
13937 0 6
6723 0 7
13921 1 6
2802 1 0
16842 0 0
1186 0 1
15159 0 1
6538 0 3
10876 0 6
8550 0 2
8407 1 2
13799 1 4
3602 0 2
6769 0 1
10096 0 6
3783 0 0
5300 0 7
15748 0 9
3636 1 9
11512 0 1
11995 1 6
6513 1 1
10264 1 9
327 0 4
4970 0 1
14845 0 3
1...

output:

0

result:

ok single line: '0'

Test #56:

score: 0
Accepted
time: 10ms
memory: 4736kb

input:

99999 37 78865
93635 0 3
7466 1 8
69485 0 5
6448 0 8
27589 1 9
28361 1 7
81186 1 0
88817 0 6
25667 1 9
8058 0 3
79958 0 6
48805 0 7
30526 1 6
49084 0 7
8767 0 5
99862 0 9
30924 1 4
6776 0 9
74729 1 8
86986 0 0
12447 1 0
49570 1 3
64500 1 6
790 1 8
81967 0 4
91577 1 4
63638 0 7
91321 0 5
28332 0 8
29...

output:

0

result:

ok single line: '0'

Test #57:

score: 0
Accepted
time: 6ms
memory: 4680kb

input:

100000 17 78821
24154 1 4
44087 1 5
10383 0 1
13756 1 9
32412 1 3
96690 1 2
16002 1 4
9425 0 0
57557 0 2
14646 0 5
56068 1 0
79700 0 8
85969 1 3
26963 1 6
31494 1 0
73037 0 9
66594 1 1
70075 1 0
22938 0 1
40356 1 3
45564 1 7
56256 0 6
57326 1 4
33025 0 4
24832 1 3
69259 0 9
18652 0 7
95473 1 6
19471...

output:

0

result:

ok single line: '0'

Test #58:

score: 0
Accepted
time: 1ms
memory: 4604kb

input:

3 54 4
2 0 9
1 0 9
1 1 9
0 0 9

output:

1

result:

ok single line: '1'

Test #59:

score: 0
Accepted
time: 1ms
memory: 4624kb

input:

5 0 8
1 1 0
4 0 0
1 0 0
0 0 0
3 0 0
0 1 0
4 1 0
2 0 0

output:

1

result:

ok single line: '1'

Test #60:

score: 0
Accepted
time: 1ms
memory: 4732kb

input:

17 0 8
8 1 0
9 1 0
16 1 0
1 0 0
11 0 0
11 1 0
15 1 0
7 0 0

output:

1

result:

ok single line: '1'

Test #61:

score: 0
Accepted
time: 1ms
memory: 4548kb

input:

353 0 260
167 1 0
8 0 0
223 1 0
176 1 0
66 1 0
59 1 0
46 0 0
281 1 0
329 1 0
43 0 0
282 1 0
237 0 0
310 1 0
117 0 0
40 0 0
305 0 0
312 1 0
205 0 0
226 1 0
270 0 0
210 1 0
259 0 0
125 1 0
299 1 0
179 1 0
112 1 0
136 0 0
245 0 0
130 0 0
230 0 0
176 0 0
178 1 0
215 0 0
50 1 0
4 0 0
86 1 0
324 0 0
186 0...

output:

1

result:

ok single line: '1'

Test #62:

score: 0
Accepted
time: 1ms
memory: 4736kb

input:

17568 54 3827
14376 0 9
17029 0 9
12493 1 9
12994 0 9
13102 0 9
16772 0 9
17304 1 9
8419 1 9
6133 1 9
7017 1 9
6572 1 9
6391 0 9
10483 0 9
6951 1 9
16551 1 9
3882 1 9
7079 1 9
8490 1 9
8520 1 9
14499 1 9
9108 1 9
11564 1 9
5604 0 9
1893 0 9
12251 1 9
3127 0 9
6764 0 9
14224 1 9
9177 1 9
10648 0 9
15...

output:

1

result:

ok single line: '1'

Test #63:

score: 0
Accepted
time: 2ms
memory: 4596kb

input:

99999 54 10346
27709 0 9
52818 0 9
70612 1 9
88316 0 9
85961 1 9
37169 0 9
27920 1 9
57315 0 9
58694 1 9
86127 0 9
51579 0 9
22257 1 9
80019 1 9
78967 0 9
83737 1 9
70766 1 9
33395 1 9
28409 1 9
25821 1 9
33334 1 9
72533 1 9
69557 1 9
53720 1 9
39951 1 9
65080 0 9
53482 1 9
15794 1 9
358 0 9
58025 0...

output:

1

result:

ok single line: '1'

Test #64:

score: 0
Accepted
time: 0ms
memory: 4668kb

input:

100000 0 5599
28407 0 0
97286 0 0
86447 1 0
3050 1 0
11131 1 0
44861 1 0
87290 0 0
41753 0 0
19908 1 0
78603 0 0
40673 1 0
35988 0 0
55951 0 0
21727 1 0
10137 1 0
89531 1 0
19745 0 0
63816 0 0
23480 0 0
87217 1 0
78247 1 0
91017 1 0
68581 1 0
20488 0 0
65598 1 0
5237 0 0
6384 1 0
53588 0 0
27390 0 0...

output:

1

result:

ok single line: '1'

Test #65:

score: 0
Accepted
time: 1ms
memory: 4728kb

input:

3 27 5
2 1 0
0 1 4
1 1 7
2 0 7
1 0 9

output:

1

result:

ok single line: '1'

Test #66:

score: 0
Accepted
time: 1ms
memory: 4692kb

input:

5 41 6
0 1 7
3 0 1
2 1 9
2 0 2
1 1 0
3 1 3

output:

0

result:

ok single line: '0'

Test #67:

score: 0
Accepted
time: 0ms
memory: 4608kb

input:

17 54 4
9 0 2
14 0 9
11 1 2
13 0 6

output:

0

result:

ok single line: '0'

Test #68:

score: 0
Accepted
time: 1ms
memory: 4676kb

input:

353 22 10
349 0 7
34 0 7
348 1 9
347 0 6
233 1 0
234 0 0
233 0 9
235 0 6
34 1 5
36 1 8

output:

0

result:

ok single line: '0'

Test #69:

score: 0
Accepted
time: 4ms
memory: 4664kb

input:

17568 28 12
2546 0 2
2547 0 4
2545 1 8
13509 0 7
2547 1 2
13507 0 4
14851 1 3
13507 1 5
2546 1 5
14850 1 9
14852 1 4
13508 0 6

output:

0

result:

ok single line: '0'

Test #70:

score: 0
Accepted
time: 27ms
memory: 4656kb

input:

99999 25 13
50414 0 6
45600 1 7
45602 0 2
50413 0 3
50415 0 3
24056 0 9
45602 1 6
24055 0 6
45600 0 6
50413 1 4
24055 1 9
24057 0 3
24057 1 3

output:

0

result:

ok single line: '0'

Test #71:

score: 0
Accepted
time: 0ms
memory: 4684kb

input:

100000 17 7
216 0 0
59855 1 9
216 1 6
27694 1 9
27695 1 1
215 1 6
214 0 2

output:

0

result:

ok single line: '0'

Test #72:

score: 0
Accepted
time: 1ms
memory: 4684kb

input:

3 35 6
2 1 5
0 0 3
1 0 3
2 0 8
1 1 4
0 1 0

output:

0

result:

ok single line: '0'

Test #73:

score: 0
Accepted
time: 1ms
memory: 4588kb

input:

5 30 10
0 0 6
1 0 7
4 1 1
1 1 9
4 0 0
3 0 9
0 1 7
2 1 0
2 0 1
3 1 1

output:

0

result:

ok single line: '0'

Test #74:

score: 0
Accepted
time: 1ms
memory: 4588kb

input:

17 29 34
0 0 2
1 1 5
8 1 1
6 1 5
15 1 0
10 0 2
9 1 4
9 0 6
2 1 6
12 0 0
15 0 7
11 1 2
6 0 8
0 1 3
13 0 2
4 0 3
1 0 0
2 0 8
11 0 5
7 1 2
7 0 6
14 0 7
8 0 5
12 1 5
16 0 3
5 1 6
10 1 1
3 0 7
5 0 2
4 1 0
16 1 1
14 1 9
13 1 3
3 1 2

output:

0

result:

ok single line: '0'

Test #75:

score: 0
Accepted
time: 1ms
memory: 4580kb

input:

353 23 706
168 0 5
56 1 2
138 0 0
155 1 1
50 0 0
169 1 1
86 1 1
335 1 5
12 1 2
34 0 4
119 1 5
95 1 1
183 0 4
214 1 5
42 1 1
307 0 4
340 1 2
220 1 8
232 1 3
13 0 4
312 1 7
113 1 7
185 0 9
54 0 1
320 0 6
310 0 1
38 0 0
339 0 6
287 1 9
281 0 1
173 0 1
33 1 0
159 1 0
308 1 1
109 1 6
346 1 7
39 1 9
273 0...

output:

0

result:

ok single line: '0'

Test #76:

score: 0
Accepted
time: 2ms
memory: 4728kb

input:

17568 47 35136
4312 0 8
11236 1 6
17029 0 7
13710 1 0
5941 0 0
14585 1 0
14335 1 0
15691 1 0
16805 1 8
6548 1 1
14818 0 9
391 1 6
2512 1 7
6082 1 1
15547 1 3
13755 1 4
2720 1 9
9313 1 7
9313 0 5
3596 0 7
14135 0 1
13469 0 0
799 0 4
7559 1 0
12800 0 8
8706 0 8
15597 0 8
12835 0 1
630 0 1
7134 0 6
115...

output:

0

result:

ok single line: '0'

Test #77:

score: 0
Accepted
time: 23ms
memory: 4732kb

input:

99999 31 199998
89064 0 6
35849 0 4
60267 1 8
66655 0 6
66106 0 1
79683 0 5
92989 1 0
25979 0 3
3927 0 0
89072 1 2
51188 1 3
58696 1 6
28140 0 9
27374 1 3
86358 1 2
51962 0 1
8747 1 3
65015 0 6
45841 1 8
96040 0 6
29587 0 0
65756 0 2
79759 0 0
95143 0 0
7361 0 0
84364 0 7
1179 0 6
552 1 5
31668 0 6
...

output:

0

result:

ok single line: '0'

Test #78:

score: 0
Accepted
time: 24ms
memory: 4728kb

input:

100000 20 200000
5048 1 3
37674 1 0
43550 0 5
52909 0 9
87454 1 0
50398 0 5
34945 0 1
22111 1 7
19641 1 1
43302 1 5
35526 0 4
56084 1 0
91170 0 7
68608 0 6
88568 0 5
99333 0 3
37031 1 8
64338 1 0
11105 1 5
82824 0 2
4074 1 2
6842 1 4
90668 1 1
97149 0 2
30602 1 0
62645 0 0
6128 1 9
17234 0 0
62032 1...

output:

0

result:

ok single line: '0'