답안 #659476

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
659476 2022-11-17T21:00:20 Z Lobo Star Trek (CEOI20_startrek) C++17
7 / 100
8 ms 12116 KB
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()

const int maxn = 5e5+10;
const int mod = 1e9+7;

int n, d;
vector<pair<int,int>> g[maxn];
void solve() {
    cin >> n >> d;

    for(int i = 1; i <= n-1; i++) {
        int u,v; cin >> u >> v;
        int idu = g[u].size();
        int idv = g[v].size();
        g[u].pb(mp(v,idv));
        g[v].pb(mp(u,idu));
    }
    int ans = 1;
    int x = 2;
    for(int i = 0; i <= 61; i++) {
        if((1LL<<i)&(2*d)) {
            ans*= x;
            ans%= mod;
        }
        x*= x;
        x%= mod;
    }
    cout << ans << endl;
}

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0);

    // freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
    int tt = 1;
    // cin >> tt;
    while(tt--) {
        solve();
    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 11988 KB Output is correct
2 Incorrect 7 ms 12116 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 11996 KB Output is correct
2 Correct 8 ms 11940 KB Output is correct
3 Correct 7 ms 11988 KB Output is correct
4 Correct 8 ms 12008 KB Output is correct
5 Correct 7 ms 12116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 11988 KB Output is correct
2 Incorrect 6 ms 11988 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 11988 KB Output is correct
2 Incorrect 6 ms 11988 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 11988 KB Output is correct
2 Incorrect 6 ms 11988 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 11988 KB Output is correct
2 Incorrect 6 ms 11988 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 11988 KB Output is correct
2 Incorrect 6 ms 11988 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 11988 KB Output is correct
2 Incorrect 7 ms 12116 KB Output isn't correct
3 Halted 0 ms 0 KB -