Submission #173951

# Submission time Handle Problem Language Result Execution time Memory
173951 2020-01-05T20:30:53 Z awlintqaa Usmjeri (COCI17_usmjeri) C++14
Compilation error
0 ms 0 KB
ll n,m;
ll hight[300009],lev[300009],dp[300009][29],done[300009];
vll v[300009];
vpll g[300009];
void dfs1(ll node,ll p){
        dp[node][0]=p;
        lev[node]=hight[node]=lev[p]+1;
        for(auto u:v[node]){
                if(u==p)C;
                dfs1(u,node);
        }
}
void fill(){
        for(ll j=1;j<20;j++){
                for(ll i=0;i<n;i++){
                        dp[i][j]=dp[dp[i][j-1]][j-1];
                }
        }
}
ll lca(ll a,ll b){
        if(lev[a]<lev[b])swap(a,b);
        ll l=lev[a]-lev[b];
        for(ll i=0;i<20;i++){
                if((l&(1<<i)))a=dp[a][i];
        }
        if(a==b)return a;
        for(ll i=19;i>=0;i--){
                if(dp[a][i]!=dp[b][i]){
                        a=dp[a][i];
                        b=dp[b][i];
                }
        }
        return dp[a][0];
}
void add(ll a,ll b,ll c){
        g[a].pb({b,c});
        g[b].pb({a,c});
}
void connect(ll node,ll p){
        for(auto u:v[node]){
                if(u==p)C;
                connect(u,node);
                hight[node]=min(hight[node],hight[u]);
                if(hight[u]<lev[node])add(u,node,0);
        }
}
ll check(ll node,ll c){
        if(done[node]!=0)return (done[node]==c);
        done[node]=c;
        for(auto u:g[node]){
                if(!check(u.fi,(c^u.se)))return 0;
        }
        return 1;
}
int main(){
        cin>>n>>m;
        for(int i=0;i<n-1;i++){
                ll a,b;
                cin>>a>>b;
                a--,b--;
                v[a].pb(b);
                v[b].pb(a);
        }
        dfs1(0,0);
        fill();
        while(m--){
                ll a,b,c;
                cin>>a>>b;
                a--,b--;
                c=lca(a,b);
                hight[a]=min(lev[c],hight[a]);
                hight[b]=min(lev[c],hight[b]);
                if(c!=a && c!=b)add(a,b,1);
        }
        connect(0,0);
        ll ans=1;
        for(int i=1;i<n;i++){
                if(done[i])C;
                if(!check(i,1)){
                        cout<<0<<endl,exit(0);
                }
                ans*=2;
                ans%=mod;
        }
        cout<<ans<<endl;
}

Compilation message

usmjeri.cpp:1:1: error: 'll' does not name a type
 ll n,m;
 ^~
usmjeri.cpp:2:1: error: 'll' does not name a type
 ll hight[300009],lev[300009],dp[300009][29],done[300009];
 ^~
usmjeri.cpp:3:1: error: 'vll' does not name a type
 vll v[300009];
 ^~~
usmjeri.cpp:4:1: error: 'vpll' does not name a type
 vpll g[300009];
 ^~~~
usmjeri.cpp:5:11: error: variable or field 'dfs1' declared void
 void dfs1(ll node,ll p){
           ^~
usmjeri.cpp:5:11: error: 'll' was not declared in this scope
usmjeri.cpp:5:19: error: 'll' was not declared in this scope
 void dfs1(ll node,ll p){
                   ^~
usmjeri.cpp: In function 'void fill()':
usmjeri.cpp:14:13: error: 'll' was not declared in this scope
         for(ll j=1;j<20;j++){
             ^~
usmjeri.cpp:14:13: note: suggested alternative: 'fill'
         for(ll j=1;j<20;j++){
             ^~
             fill
usmjeri.cpp:14:20: error: 'j' was not declared in this scope
         for(ll j=1;j<20;j++){
                    ^
usmjeri.cpp:15:24: error: expected ';' before 'i'
                 for(ll i=0;i<n;i++){
                        ^
usmjeri.cpp:15:28: error: 'i' was not declared in this scope
                 for(ll i=0;i<n;i++){
                            ^
usmjeri.cpp:15:30: error: 'n' was not declared in this scope
                 for(ll i=0;i<n;i++){
                              ^
usmjeri.cpp:16:25: error: 'dp' was not declared in this scope
                         dp[i][j]=dp[dp[i][j-1]][j-1];
                         ^~
usmjeri.cpp: At global scope:
usmjeri.cpp:20:1: error: 'll' does not name a type; did you mean 'fill'?
 ll lca(ll a,ll b){
 ^~
 fill
usmjeri.cpp:35:10: error: variable or field 'add' declared void
 void add(ll a,ll b,ll c){
          ^~
usmjeri.cpp:35:10: error: 'll' was not declared in this scope
usmjeri.cpp:35:10: note: suggested alternative: 'fill'
 void add(ll a,ll b,ll c){
          ^~
          fill
usmjeri.cpp:35:15: error: 'll' was not declared in this scope
 void add(ll a,ll b,ll c){
               ^~
usmjeri.cpp:35:15: note: suggested alternative: 'fill'
 void add(ll a,ll b,ll c){
               ^~
               fill
usmjeri.cpp:35:20: error: 'll' was not declared in this scope
 void add(ll a,ll b,ll c){
                    ^~
usmjeri.cpp:35:20: note: suggested alternative: 'fill'
 void add(ll a,ll b,ll c){
                    ^~
                    fill
usmjeri.cpp:39:14: error: variable or field 'connect' declared void
 void connect(ll node,ll p){
              ^~
usmjeri.cpp:39:14: error: 'll' was not declared in this scope
usmjeri.cpp:39:14: note: suggested alternative: 'fill'
 void connect(ll node,ll p){
              ^~
              fill
usmjeri.cpp:39:22: error: 'll' was not declared in this scope
 void connect(ll node,ll p){
                      ^~
usmjeri.cpp:39:22: note: suggested alternative: 'fill'
 void connect(ll node,ll p){
                      ^~
                      fill
usmjeri.cpp:47:1: error: 'll' does not name a type; did you mean 'fill'?
 ll check(ll node,ll c){
 ^~
 fill
usmjeri.cpp: In function 'int main()':
usmjeri.cpp:56:9: error: 'cin' was not declared in this scope
         cin>>n>>m;
         ^~~
usmjeri.cpp:56:9: note: suggested alternative: 'main'
         cin>>n>>m;
         ^~~
         main
usmjeri.cpp:56:14: error: 'n' was not declared in this scope
         cin>>n>>m;
              ^
usmjeri.cpp:56:17: error: 'm' was not declared in this scope
         cin>>n>>m;
                 ^
usmjeri.cpp:58:17: error: 'll' was not declared in this scope
                 ll a,b;
                 ^~
usmjeri.cpp:59:22: error: 'a' was not declared in this scope
                 cin>>a>>b;
                      ^
usmjeri.cpp:59:25: error: 'b' was not declared in this scope
                 cin>>a>>b;
                         ^
usmjeri.cpp:61:17: error: 'v' was not declared in this scope
                 v[a].pb(b);
                 ^
usmjeri.cpp:64:9: error: 'dfs1' was not declared in this scope
         dfs1(0,0);
         ^~~~
usmjeri.cpp:67:17: error: 'll' was not declared in this scope
                 ll a,b,c;
                 ^~
usmjeri.cpp:67:17: note: suggested alternative: 'fill'
                 ll a,b,c;
                 ^~
                 fill
usmjeri.cpp:68:22: error: 'a' was not declared in this scope
                 cin>>a>>b;
                      ^
usmjeri.cpp:68:25: error: 'b' was not declared in this scope
                 cin>>a>>b;
                         ^
usmjeri.cpp:70:17: error: 'c' was not declared in this scope
                 c=lca(a,b);
                 ^
usmjeri.cpp:70:19: error: 'lca' was not declared in this scope
                 c=lca(a,b);
                   ^~~
usmjeri.cpp:71:17: error: 'hight' was not declared in this scope
                 hight[a]=min(lev[c],hight[a]);
                 ^~~~~
usmjeri.cpp:71:30: error: 'lev' was not declared in this scope
                 hight[a]=min(lev[c],hight[a]);
                              ^~~
usmjeri.cpp:71:26: error: 'min' was not declared in this scope
                 hight[a]=min(lev[c],hight[a]);
                          ^~~
usmjeri.cpp:71:26: note: suggested alternative: 'main'
                 hight[a]=min(lev[c],hight[a]);
                          ^~~
                          main
usmjeri.cpp:73:33: error: 'add' was not declared in this scope
                 if(c!=a && c!=b)add(a,b,1);
                                 ^~~
usmjeri.cpp:75:9: error: 'connect' was not declared in this scope
         connect(0,0);
         ^~~~~~~
usmjeri.cpp:76:9: error: 'll' was not declared in this scope
         ll ans=1;
         ^~
usmjeri.cpp:76:9: note: suggested alternative: 'fill'
         ll ans=1;
         ^~
         fill
usmjeri.cpp:78:20: error: 'done' was not declared in this scope
                 if(done[i])C;
                    ^~~~
usmjeri.cpp:78:20: note: suggested alternative: 'long'
                 if(done[i])C;
                    ^~~~
                    long
usmjeri.cpp:78:28: error: 'C' was not declared in this scope
                 if(done[i])C;
                            ^
usmjeri.cpp:79:21: error: 'check' was not declared in this scope
                 if(!check(i,1)){
                     ^~~~~
usmjeri.cpp:80:25: error: 'cout' was not declared in this scope
                         cout<<0<<endl,exit(0);
                         ^~~~
usmjeri.cpp:80:34: error: 'endl' was not declared in this scope
                         cout<<0<<endl,exit(0);
                                  ^~~~
usmjeri.cpp:80:34: note: suggested alternative: 'enum'
                         cout<<0<<endl,exit(0);
                                  ^~~~
                                  enum
usmjeri.cpp:80:39: error: 'exit' was not declared in this scope
                         cout<<0<<endl,exit(0);
                                       ^~~~
usmjeri.cpp:82:17: error: 'ans' was not declared in this scope
                 ans*=2;
                 ^~~
usmjeri.cpp:83:22: error: 'mod' was not declared in this scope
                 ans%=mod;
                      ^~~
usmjeri.cpp:83:22: note: suggested alternative: 'void'
                 ans%=mod;
                      ^~~
                      void
usmjeri.cpp:85:9: error: 'cout' was not declared in this scope
         cout<<ans<<endl;
         ^~~~
usmjeri.cpp:85:15: error: 'ans' was not declared in this scope
         cout<<ans<<endl;
               ^~~
usmjeri.cpp:85:20: error: 'endl' was not declared in this scope
         cout<<ans<<endl;
                    ^~~~
usmjeri.cpp:85:20: note: suggested alternative: 'enum'
         cout<<ans<<endl;
                    ^~~~
                    enum