/ tabris /

记录详情

Compile Error

/in/foo.c:1:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/STACK:102400000,102400000") 
 
/in/foo.c:2:24: fatal error: bits/stdc++.h: No such file or directory
 #include<bits/stdc++.h>
                        ^
compilation terminated.

代码

#pragma comment(linker, "/STACK:102400000,102400000") 
#include<bits/stdc++.h>
using namespace std;

const int N = 1e5+5;
const int mod =1000000007;
typedef long long ll;
struct node{
    int v,c;
};

vector<node>G[N];
int cnt[36][N];
ll XOR[N];
int SUM[N];
void dfs(int now,int fa){
    SUM[now]=1;
    for(int i=0;i<=31;i++)if((1ll<<i) & XOR[now])cnt[i][now]++;
    for(int i=0;i<G[now].size();i++){
        node NOW = G[now][i];
        int v = NOW.v,c = NOW.c;
        if(v==fa)continue;
            XOR[v] = XOR[now] ^ c;
            dfs(v,now);
            SUM[now] += SUM[v];
        for(int j=0;j<=31;j++)cnt[j][now] += cnt[j][v];
    }
}


int main(){
//    freopen("in.txt","r",stdin);

    int n;scanf("%d",&n);
    int u,v,c;
    for(int i=1;i<n;i++){
        scanf("%d%d%d",&u,&v,&c);
        G[u].push_back(node{v,c});
        G[v].push_back(node{u,c});
    }
        XOR[1]=0;
        dfs(1,1);
//    for(int i=1;i<=n;i++)printf("%d%c",SUM[i],i==n?'\n':' ');
    for(int i=1;i<=n;i++){
        ll ans = 0;
        for(int j=0;j<=31;j++)ans = (ans + (1ll<<j)*cnt[j][i]%mod*(SUM[i]-cnt[j][i])%mod)%mod;
        printf("%lld ",ans%mod);
    }
    puts("");
    return 0;
}

信息

递交者
类型
递交
语言
C
递交时间
2019-06-12 20:55:32
评测时间
2019-06-12 20:55:32
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes