CSES - Datatähti Open 2019 - Results
Submission details
Task:Function
Sender:UrX
Submission time:2019-01-18 19:06:08 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.03 s1details
#2--1details
#3--1details
#4--1details
#50.01 s1details
#6--1details
#7--1details
#80.02 s1details
#90.02 s1details
#100.01 s2details
#11--2details
#12--2details
#13--2details
#14--2details
#15--2details
#16--2details
#17--2details
#180.02 s2details
#19--2details
#20--2details
#210.01 s2details
#22--2details
#23--2details
#24--2details
#25--2details
#26--2details
#270.10 s2details
#28--2details
#29--2details
#30--2details
#31--2details
#32--2details
#33--2details
#34--2details
#35--2details

Code

#include <bits/stdc++.h>

using namespace std;

#define ll long long

const ll M = 1000000007;

unordered_map<ll, ll> denied;

struct mod_num
{
    ll val;

    mod_num(ll in)
    {
        val = in % M;
    }

    void put(ll in)
    {
        val = in % M;
    }

    ll get()
    {
        return val % M;
    }

    mod_num operator *(mod_num a)
    {
        mod_num out((a.get() * val) % M);

        return out;
    }

    mod_num operator +(mod_num a)
    {
        mod_num out((a.get() + val) % M);

        return out;
    }
};



mod_num tree(ll depth, ll pos)
{
    if(denied.find(pos) != denied.end())
        return 0;

    if(depth == 0)
        return 1;

    return tree(depth - 1, 2 * pos) + tree(depth - 1, 2 * pos + 1);
}


int main()
{
    ll N, M;

    cin >> N >> M;

    N--;

    for(ll i = 0; i < M; i++)
    {
        ll temp;

        cin >> temp;

        denied[temp] = 0;
    }

    if(M == 0)
    {
        N--;


        mod_num k(2);

        mod_num ans(1);

        for(ll i = 0; i < N; i++)
        {
            ans = k * ans;
        }

        cout << (k * ans * ans).get();
    }

    else{
        if(denied.find(3) != denied.end() || denied.find(2) != denied.end())
            cout << 0;
        else
            cout << tree(N - 1, 2).get() * tree(N - 1, 3).get() * 2;
    }
    return 0;
}

Test details

Test 1

Group: 1

Verdict:

input
12
2
0 0
1 1
5
...

correct output
YES
YES
NO
YES
YES
...

user output
2097152

Test 2

Group: 1

Verdict:

input
100
2
92 30
22 44
2
...

correct output
YES
YES
YES
YES
YES
...

user output
(empty)

Test 3

Group: 1

Verdict:

input
100
3
-55 -98
-59 -55
-2 88
...

correct output
YES
YES
YES
YES
YES
...

user output
(empty)

Test 4

Group: 1

Verdict:

input
100
4
87 81
-84 42
18 -46
...

correct output
YES
YES
YES
YES
YES
...

user output
(empty)

Test 5

Group: 1

Verdict:

input
100
1000
-81 38
92 -21
-10 -65
...

correct output
NO
NO
NO
NO
NO
...

user output
0

Test 6

Group: 1

Verdict:

input
100
110
-99 -9
-98 -9
-96 -8
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 7

Group: 1

Verdict:

input
100
78
-100 95
-99 96
-98 95
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 8

Group: 1

Verdict:

input
100
201
-100 97
-100 96
-99 99
...

correct output
NO
NO
NO
NO
NO
...

user output
0

Test 9

Group: 1

Verdict:

input
100
45
-100 89
-100 90
-97 90
...

correct output
YES
NO
NO
NO
NO
...

user output
0

Test 10

Group: 2

Verdict:

input
13
2
0 0
1 1
5
...

correct output
YES
YES
NO
YES
YES
...

user output
8388608

Test 11

Group: 2

Verdict:

input
100
2
-517113909 -39540276
-209411537 -831819487
2
...

correct output
YES
YES
YES
YES
YES
...

user output
(empty)

Test 12

Group: 2

Verdict:

input
100
3
-991349544 139282777
646238126 16140762
-4488261 817588303
...

correct output
YES
YES
YES
YES
YES
...

user output
(empty)

Test 13

Group: 2

Verdict:

input
100
4
891187584 -889373775
-453505448 -469134344
-683807769 8725517
...

correct output
YES
NO
YES
NO
NO
...

user output
(empty)

Test 14

Group: 2

Verdict:

input
100
1000
-866614983 -994037153
775605588 -328510132
390868551 927606059
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 15

Group: 2

Verdict:

input
100
1000
-911073332 -1000000000
-905159999 -1000000000
-904949593 -999999999
...

correct output
YES
YES
YES
NO
NO
...

user output
(empty)

Test 16

Group: 2

Verdict:

input
100
1000
-1000000000 950042028
-946551105 -1000000000
-940508390 -1000000000
...

correct output
NO
YES
YES
YES
NO
...

user output
(empty)

Test 17

Group: 2

Verdict:

input
100
1000
-949977239 -1000000000
-948279892 -1000000000
-947497811 -999999999
...

correct output
YES
YES
YES
YES
YES
...

user output
(empty)

Test 18

Group: 2

Verdict:

input
100
806
-899 -1000
-898 -1000
-896 -999
...

correct output
NO
NO
NO
NO
NO
...

user output
0

Test 19

Group: 2

Verdict:

input
100
777
-1000 914
-1000 915
-999 916
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 20

Group: 2

Verdict:

input
100
775
-999 998
-995 -1000
-994 -1000
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 21

Group: 2

Verdict:

input
13
2
0 0
1 1
5
...

correct output
YES
YES
NO
YES
YES
...

user output
8388608

Test 22

Group: 2

Verdict:

input
1
999748
-995394098 -1000000000
-995392159 -1000000000
-995386584 -999999999
...

correct output
NO

user output
(empty)

Test 23

Group: 2

Verdict:

input
1
1000000
-954368893 -1000000000
-954366895 -1000000000
-954364896 -999999999
...

correct output
YES

user output
(empty)

Test 24

Group: 2

Verdict:

input
1
1000000
-1000000000 928772368
-1000000000 928772506
-999999999 928772642
...

correct output
YES

user output
(empty)

Test 25

Group: 2

Verdict:

input
1
999754
-901705699 -1000000000
-901702695 -1000000000
-901702062 -999999999
...

correct output
NO

user output
(empty)

Test 26

Group: 2

Verdict:

input
100
10000
-1000000000 919783772
-918885599 -1000000000
-918825263 -1000000000
...

correct output
NO
YES
YES
NO
NO
...

user output
(empty)

Test 27

Group: 2

Verdict:

input
10
99998
-997024120 -77018772
-997011201 -77017738
-996986132 -77015834
...

correct output
YES
YES
NO
YES
YES
...

user output
130048

Test 28

Group: 2

Verdict:

input
100
7934
-10000 9905
-10000 9906
-9999 9906
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 29

Group: 2

Verdict:

input
100
9710
-99754 -6983
-99786 -6055
-99751 -6548
...

correct output
YES
NO
NO
NO
NO
...

user output
(empty)

Test 30

Group: 2

Verdict:

input
100
2
802396401 -641287652
30956766 -527704723
2
...

correct output
YES
YES
YES
YES
YES
...

user output
(empty)

Test 31

Group: 2

Verdict:

input
100
3
755025461 -953536159
-402145543 137775005
-700733185 821755784
...

correct output
YES
YES
YES
YES
YES
...

user output
(empty)

Test 32

Group: 2

Verdict:

input
100
4
-673213071 571383249
-963633735 -859013318
-591788323 791136643
...

correct output
NO
NO
NO
NO
YES
...

user output
(empty)

Test 33

Group: 2

Verdict:

input
100
5
-124483012 623794901
233757283 -234519096
-987338502 737259422
...

correct output
NO
NO
YES
NO
NO
...

user output
(empty)

Test 34

Group: 2

Verdict:

input
100
1000
154383911 872030445
-9594726 190227899
908758769 -9615631
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)

Test 35

Group: 2

Verdict:

input
100
10000
642800667 -694556052
-343795089 -341227394
800920828 676674460
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)