Submission #559029

# Submission time Handle Problem Language Result Execution time Memory
559029 2022-05-09T09:18:05 Z Stickfish Star Trek (CEOI20_startrek) C++17
7 / 100
2 ms 2656 KB
	#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

const int MAXN = 1e5 + 123;
const ll MOD = 1000000007;
vector<int> edg[MAXN];

ll pw(ll a, ll m) {
    if (!m)
        return 1;
    a %= MOD;
    if (m % 2)
        return pw(a, m - 1) * a % MOD;
    return pw(a * a, m >> 1);
}

signed main() {
    ll n, d;
    cin >> n >> d;
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        edg[u].push_back(v);
        edg[v].push_back(u);
    }
    if (n == 2) {
        // 2 * 4^{d - 1} + 2^2 * 4^{d - 2} + 2^3 * 4^{d - 3} + ... + 2^k * 4^{d - k}
        // 2^{2d - 1} + 2^{2d - 2} + 2^{2d - 3} + ... + 2^{2d - d} = 2^d * (1 + 2 + 4 + ... + 2^{d - 1})
        cout << pw(4, d) << endl;
        return 0;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 1 ms 2656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -