답안 #559029

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -