# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003080 |
2024-06-20T05:16:47 Z |
vjudge1 |
Subtree (INOI20_subtree) |
C++17 |
|
648 ms |
1048576 KB |
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define int ll
#define MAX 1000001
#define INF INT_MAX
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define ins insert
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define lb(a,b) lower_bound(all(a),b)
#define ub(a,b) upper_bound(all(a),b)
#define sortv(a) sort(all(a))
#define outputar(a,b){\
for(int i=0;i<b;i++){\
cout << a[i] << " ";\
}\
cout << endl;\
}
#define outputvec(a){\
for(auto x:a){\
cout << (int)x << " ";\
}\
cout << endl;\
}
#define reset(a,n,v){\
for(int i=0;i<n;i++){\
a[i]=v;\
}\
}
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef tuple<ll,ll,ll> tll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef double db;
typedef long double ldb;
inline void USACO(string filename){
freopen((filename+".in").c_str(),"r",stdin);
freopen((filename+".out").c_str(),"w",stdout);
}
int n,q,t=1,m,k,x,y,z,x2,y2,z2,a[MAX],b[MAX],d[MAX],e[MAX];
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string s[MAX],str[MAX];
//int e[1001][1001];
string s1,s2,s3;
const int mod = 998244353;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
vector<vector<int>> g;
int res=0;
void dfs(int v,int prev){
a[v]=1;
for(auto x:g[v]){
if(x==prev){
continue;
}
dfs(x,v);
a[v]*=(a[x]+1);
a[v]%=MOD;
}
res+=a[v];
res%=MOD;
}
void solve(){
cin >> n >> m;
g.clear();
g.resize(n+1);
for(int i=0;i<m;i++){
cin >> x >> y;
g[x].pb(y);
g[y].pb(x);
}
dfs(1,-1);
cout << res << "\n";
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("input13.txt","r",stdin);
//cin >> t;
ll cnt1=1;
while(t--){
solve();
cnt1++;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
648 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
64088 KB |
Output is correct |
2 |
Correct |
28 ms |
64860 KB |
Output is correct |
3 |
Correct |
55 ms |
72164 KB |
Output is correct |
4 |
Correct |
51 ms |
72020 KB |
Output is correct |
5 |
Correct |
59 ms |
72020 KB |
Output is correct |
6 |
Correct |
51 ms |
72280 KB |
Output is correct |
7 |
Correct |
55 ms |
73792 KB |
Output is correct |
8 |
Correct |
56 ms |
73364 KB |
Output is correct |
9 |
Correct |
52 ms |
73504 KB |
Output is correct |
10 |
Correct |
49 ms |
72784 KB |
Output is correct |
11 |
Correct |
51 ms |
72132 KB |
Output is correct |
12 |
Correct |
54 ms |
71508 KB |
Output is correct |
13 |
Correct |
50 ms |
71500 KB |
Output is correct |
14 |
Correct |
49 ms |
73076 KB |
Output is correct |
15 |
Correct |
55 ms |
73976 KB |
Output is correct |
16 |
Correct |
57 ms |
74168 KB |
Output is correct |
17 |
Correct |
53 ms |
71504 KB |
Output is correct |
18 |
Correct |
54 ms |
71508 KB |
Output is correct |
19 |
Correct |
52 ms |
71504 KB |
Output is correct |
20 |
Correct |
43 ms |
72168 KB |
Output is correct |
21 |
Correct |
45 ms |
72528 KB |
Output is correct |
22 |
Correct |
50 ms |
72276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
648 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
648 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |