이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
//#define int long long
typedef unsigned long long ull;
using namespace std;
struct edge{
int x,l,r;
};
const int N=1e5+5;
int n,m,ans[N];
vector<edge> adj[N];
bitset<N> bs[N];
void dfs(int node,int p){
bs[node].count();
for (auto u:adj[node]){
if (p==u.x) continue;
bs[u.x]=bs[node];
for (int i=u.l;i<=u.r;i++) bs[u.x][i]=1;
dfs(u.x,node);
}return;
}
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n>>m;
for (int i=1;i<n;i++){
int x,y,l,r;
cin>>x>>y>>l>>r;
adj[x].pb({y,l,r});
adj[y].pb({x,l,r});
}dfs(1,0);
for (int i=2;i<=n;i++) cout<<bs[i].count()<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |