Submission details
Task:Polut
Sender:alli
Submission time:2026-01-19 17:01:19 +0200
Language:C++ (C++20)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
#40
#50
Test results
testverdicttimegroup
#1--1, 3, 4, 5details
#2--1, 4, 5details
#3--1, 4, 5details
#4--1, 4, 5details
#5--2, 5details
#6--2, 5details
#7--2, 4, 5details
#8--3, 5details
#9--3, 5details
#10--3, 4, 5details
#11--4, 5details
#12--4, 5details
#13--5details
#14--5details
#15--4, 5details
#16--1, 4, 5details

Code

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

#define M 1000000007

int n, m, p;

ll e[11];
ll z[101010];
vector<int> v[101010];

/*void haku(int k, const set<int>& r) {
    queue<pair<int,int>> q;
    cout << "i: ";
    for (int i : r) {
        q.emplace(i,0);
        cout << i << " ";
    } cout << "\n";
    int a = 0;
    while (!q.empty()) {
        int x = q.front().first, c = q.front().second; q.pop();
        cout << "x: " << x << "\n";
        if (c == k) {
            if (x == n) {
                a++;
            }
            continue;
        }
        for (int i : v[x]) {
            if (z[i][c+1]) continue;
            z[i][c+1] = 1;
            q.emplace(i,c+1);
        }
    }
    cout << "a: " << a << "\n";
}*/

int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(nullptr);
    //freopen(R"(C:\Users\Kymppi\Downloads\test_input.txt)", "r", stdin);

    cin >> n >> m >> p;
    for (int i = 1; i <= m; i++) {
        int a, b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    vector<ll> r;
    r.push_back(1);
    z[1] = 1;
    ll s = 0;
    for (int c = 0; c <= 101010; c++) {
        vector<pair<ll,ll>> r2 = {};
        for (auto x : r) {
            r2.emplace_back(x,z[x]);
        }
        r.clear();
        memset(z,0,sizeof(z));
        for (auto [x, d] : r2) {
            //cout << x << " " << d << "\n";
            if (x == n) {
                if (s == 0) s = c;
                if (c-s < p) {
                    e[c-s] += d;
                    e[c-s] %= M;
                }else {
                    break;
                }
            }
            for (int i : v[x]) {
                if (!z[i]) r.push_back(i);
                z[i] += d;
                z[i] %= M;
            }
        }
    }
    //cout << "shortest distance: " << s << "\n";
    for (int i = 0; i < p; i++) cout << e[i] << " ";
}

Test details

Test 1 (public)

Group: 1, 3, 4, 5

Verdict:

input
4 5 3
1 2
1 3
2 3
2 4
...

correct output
2 2 10 

user output
(empty)

Test 2

Group: 1, 4, 5

Verdict:

input
2 1 1
2 1

correct output

user output
(empty)

Test 3

Group: 1, 4, 5

Verdict:

input
10 20 10
6 10
8 1
4 6
9 1
...

correct output
2 5 34 123 611 2503 11415 4882...

user output
(empty)

Test 4

Group: 1, 4, 5

Verdict:

input
10 20 10
4 10
2 3
8 4
7 8
...

correct output
1 7 26 140 509 2483 9454 43570...

user output
(empty)

Test 5

Group: 2, 5

Verdict:

input
100000 200000 2
96303 53915
64836 4748
6389 40954
60420 91374
...

correct output
1 0 

user output
(empty)

Test 6

Group: 2, 5

Verdict:

input
100000 200000 2
72817 17293
93269 856
51497 26888
41679 96276
...

correct output
5 8 

user output
(empty)

Test 7

Group: 2, 4, 5

Verdict:

input
474 517 2
1 2
1 3
2 4
3 4
...

correct output
0 0 

user output
(empty)

Test 8

Group: 3, 5

Verdict:

input
100000 200000 3
59846 53439
11468 57874
83443 13914
46177 15147
...

correct output
1 0 32 

user output
(empty)

Test 9

Group: 3, 5

Verdict:

input
100000 200000 3
23665 7205
83252 56604
14852 7299
2836 9864
...

correct output
1 0 33 

user output
(empty)

Test 10

Group: 3, 4, 5

Verdict:

input
474 517 3
1 2
1 3
2 4
3 4
...

correct output
0 0 986681410 

user output
(empty)

Test 11

Group: 4, 5

Verdict:

input
1000 2000 10
691 424
80 318
681 539
33 342
...

correct output
1 6 39 252 1242 7715 36269 212...

user output
(empty)

Test 12

Group: 4, 5

Verdict:

input
1000 2000 10
979 324
770 562
560 7
169 738
...

correct output
2 2 81 150 2435 6460 66843 223...

user output
(empty)

Test 13

Group: 5

Verdict:

input
100000 200000 10
54544 86042
14060 20746
47891 4317
76648 84193
...

correct output
1 3 54 169 1917 6237 56922 192...

user output
(empty)

Test 14

Group: 5

Verdict:

input
100000 200000 10
73275 88704
74521 54506
51906 57193
29561 44568
...

correct output
6 19 338 1212 12462 49357 3873...

user output
(empty)

Test 15

Group: 4, 5

Verdict:

input
1000 1989 10
822 821
979 989
138 139
968 981
...

correct output
1 44 2935 131120 6357888 28564...

user output
(empty)

Test 16

Group: 1, 4, 5

Verdict:

input
3 3 1
1 2
1 3
2 3

correct output

user output
(empty)