Submission #778166

# Submission time Handle Problem Language Result Execution time Memory
778166 2023-07-10T06:56:38 Z vjudge1 Deblo (COCI18_deblo) C++17
0 / 90
46 ms 11780 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],tree[400005],n;
vector <int> v[100005];
vector <int> ger;

inline void build(int node,int start,int end){
    if(start==end){
        tree[node]=dizi[start];
        return ;
    }
    build(node*2,start,mid),build(node*2+1,mid+1,end);
    tree[node]=tree[node*2]^tree[node*2+1];
}

inline int query(int node,int start,int end,int l,int r){
    if(start>end || start>r || end<l)return 0;
    if(start>=l && end<=r)return tree[node];
    return query(node*2,start,mid,l,r)^query(node*2+1,mid+1,end,l,r);
}

int32_t main(){
    faster
    cin>>n;
    int cev=0;
    for(int i=1;i<=n;i++){
        cin>>dizi[i];
        cev+=dizi[i];
    }
    build(1,1,n);
    for(int i=1;i<n;i++){
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
        ger.push_back(query(1,1,n,a,b));
    }
    //cout<<ger.size()<<endl;
    for(int i=0;i<ger.size();i++){
        cev+=ger[i];
        //cur^=ger[i];
    }
    cout<<cev<<'\n';
    return 0;
}

Compilation message

deblo.cpp: In function 'int32_t main()':
deblo.cpp:44: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]
   44 |     for(int i=0;i<ger.size();i++){
      |                 ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Incorrect 2 ms 2680 KB Output isn't correct
3 Incorrect 1 ms 2688 KB Output isn't correct
4 Incorrect 2 ms 2772 KB Output isn't correct
5 Incorrect 2 ms 2772 KB Output isn't correct
6 Incorrect 46 ms 11296 KB Output isn't correct
7 Incorrect 37 ms 11212 KB Output isn't correct
8 Incorrect 36 ms 11668 KB Output isn't correct
9 Incorrect 35 ms 11684 KB Output isn't correct
10 Incorrect 31 ms 11780 KB Output isn't correct