Submission #566842

# Submission time Handle Problem Language Result Execution time Memory
566842 2022-05-23T03:34:26 Z azberjibiou Star Trek (CEOI20_startrek) C++17
0 / 100
1000 ms 7380 KB
#include <bits/stdc++.h>
#define gibon ios::sync_with_stdio(false); cin.tie(0);
#define fir first
#define sec second
#define pdd pair<long double, long double>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double
#define pmax pair<__int128, __int128>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
using namespace std;
int dx[4]= {0, 1, 0, -1}, dy[4]= {1, 0, -1, 0};
int ddx[8]={1, 1, 0, -1, -1, -1, 0, 1}, ddy[8]={0, 1, 1, 1, 0, -1, -1, -1};
const int mxN=100025;
const int mxM=300005;
const int mxK=1000000000;
const ll MOD=1000'000'007;
const ll INF=1000000000000000005;
ll N, D;
vector <int> v[mxN];
int outw[mxN];
int downw[mxN], upw[mxN];
bool W[mxN];
int degL[mxN];
vector <int> v1[mxN], v2[mxN];
int sizw1[mxN], leafw2[mxN], sizl2[mxN], par1[mxN], par2[mxN];
ll numw;
void dfs_downw(int now, int pre)
{
    for(int nxt : v[now])   if(nxt!=pre)
    {
        dfs_downw(nxt, now);
    }
    downw[now]=(outw[now]==0 ? 1 : 0);
    if(now!=1)  outw[pre]+=downw[now];
}
void dfs_upw(int now, int pre)
{
    if(now!=1)
    {
        upw[now]=(outw[pre]-downw[now]==0 ? 1 : 0);
        outw[now]+=upw[now];
    }
    for(int nxt : v[now])   if(nxt!=pre)
    {
        dfs_upw(nxt, now);
    }
}
int findpar(int a, int typ)
{
    if(typ==1)  return (par1[a]==a ? a : par1[a]=findpar(par1[a], 1));
    else    return (par2[a]==a ? a : par2[a]=findpar(par2[a], 2));
}
void onion(int a, int b, int typ)
{
    int p=findpar(a, typ), q=findpar(b, typ);
    if(typ==1)
    {
        par1[p]=q;  sizw1[q]+=sizw1[p];
    }
    else
    {
        par2[p]=q;  sizl2[q]+=sizl2[p]; leafw2[q]+=leafw2[p];
    }
}
int main()
{
    gibon
    cin >> N >> D;
  	ll ans=1;
    for(int i=1;i<=D;i++)ans=4*ans%MOD;
  	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Incorrect 5 ms 7380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7376 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Execution timed out 1090 ms 7380 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Incorrect 6 ms 7252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Incorrect 6 ms 7252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Incorrect 6 ms 7252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Incorrect 6 ms 7252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Incorrect 6 ms 7252 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Incorrect 5 ms 7380 KB Output isn't correct
3 Halted 0 ms 0 KB -