답안 #778204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778204 2023-07-10T07:25:21 Z vjudge1 Deblo (COCI18_deblo) C++17
0 / 90
40 ms 16236 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
#define OYY 1000000005
#define mod 998244353
#define mid (start+end)/2
int dizi[100005],n,cev=0;
vector <int> v[100005];

void dfs(int node,int ata,int tut){
    int cur=0;
    for(int i=0;i<v[node].size();i++){
        if(v[node][i]==ata)continue;
        cur^=v[node][i];
        //cout<<"e "<<cur<<endl;
        dfs(v[node][i],node,cur);
    }
    cev+=cur;
    cev+=tut;
   // cout<<node<<" "<<cev<<endl;
}

int32_t main(){
    faster
    cin>>n;
    int c=0;
    for(int i=1;i<=n;i++){
        cin>>dizi[i];
        c+=dizi[i];
    }
    for(int i=1;i<n;i++){
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(1,0,0);
    cout<<cev<<'\n';
    return 0;
}

Compilation message

deblo.cpp: In function 'void dfs(long long int, long long int, long long int)':
deblo.cpp:13:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<v[node].size();i++){
      |                 ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Incorrect 1 ms 2644 KB Output isn't correct
3 Incorrect 1 ms 2676 KB Output isn't correct
4 Incorrect 2 ms 2688 KB Output isn't correct
5 Incorrect 2 ms 2644 KB Output isn't correct
6 Incorrect 31 ms 16236 KB Output isn't correct
7 Incorrect 31 ms 16128 KB Output isn't correct
8 Incorrect 29 ms 10212 KB Output isn't correct
9 Incorrect 29 ms 9556 KB Output isn't correct
10 Incorrect 40 ms 9004 KB Output isn't correct