Detalii evaluare #51593319

Rezumat problemă

Se dau un arbore cu N noduri și rădăcina în nodul 1 al cărui muchii au lungimi exprimate prin numere naturale nenule și Q query-uri de forma u v. Pentru fiecare query să se afle suma lungimilor tuturor drumurilor distincte de la un nod aflat în subarborele cu rădăcina în nodul u la un nod aflat în subarborele cu rădăcina în nodul v modulo \( {10}^{9} + 7 \)(lungimea unui drum este egală cu suma lungimilor tuturor muchiilor ce îl alcătuiesc).

Detalii

Problema paths_sums Operații I/O tastatură/ecran
Limita timp 0.6 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #51593319 Utilizator Morar Andrei (HCC_cyber_gorilla) (justmorii)
Fișier paths_sums.cpp Dimensiune 3.61 KB
Data încărcării 17 Iulie 2024, 19:15 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

paths_sums.cpp:9:11: error: uninitialized const 'nmax' [-fpermissive]
 const int nmax;

           ^
paths_sums.cpp:12:23: error: array bound is not an integer constant before ']' token
 int rmq[25][nmax*2 + 1];

                       ^
paths_sums.cpp:15:22: error: array bound is not an integer constant before ']' token
 long long dist[nmax+1];

                      ^
paths_sums.cpp:16:13: error: the value of 'nmax' is not usable in a constant expression
 bitset<nmax+1>viz;

             ^
paths_sums.cpp:9:11: note: 'nmax' was not initialized with a constant expression
 const int nmax;

           ^
paths_sums.cpp:16:14: error: the value of 'nmax' is not usable in a constant expression
 bitset<nmax+1>viz;

              ^
paths_sums.cpp:9:11: note: 'nmax' was not initialized with a constant expression
 const int nmax;

           ^
paths_sums.cpp:16:14: note: in template argument for type 'unsigned int' 
 bitset<nmax+1>viz;

              ^
paths_sums.cpp:16:18: error: invalid type in declaration before ';' token
 bitset<nmax+1>viz;

                  ^
paths_sums.cpp:17:20: error: array bound is not an integer constant before ']' token
 long long dp[nmax+1];

                    ^
paths_sums.cpp:18:21: error: array bound is not an integer constant before ']' token
 long long sum[nmax+1];

                     ^
paths_sums.cpp:19:24: error: array bound is not an integer constant before ']' token
 long long normal[nmax+1];

                        ^
paths_sums.cpp:21:30: error: array bound is not an integer constant before ']' token
 vector<pair<int,int>>M[nmax+1];

                              ^
paths_sums.cpp:22:14: error: array bound is not an integer constant before ']' token
  int h[nmax+1];

              ^
paths_sums.cpp:23:16: error: array bound is not an integer constant before ']' token
  int a[2*nmax+1];

                ^
paths_sums.cpp:24:16: error: array bound is not an integer constant before ']' token
   int p1[nmax+1];

                ^
paths_sums.cpp: In function 'void bfs()':
paths_sums.cpp:31:14: error: invalid types 'int[int]' for array subscript
         viz[1]  = 1;

              ^
paths_sums.cpp:35:28: error: 'M' was not declared in this scope
               for(auto i : M[x])

                            ^
paths_sums.cpp:40:21: error: invalid types 'int[int]' for array subscript
            viz[vecin] = 1;

                     ^
paths_sums.cpp:41:22: error: 'normal' was not declared in this scope
                      normal[vecin] = (normal[x]%mod + cost%mod)%mod;

                      ^
paths_sums.cpp:41:55: error: 'cost' was not declared in this scope
                      normal[vecin] = (normal[x]%mod + cost%mod)%mod;

                                                       ^
paths_sums.cpp: In function 'void dfs(int)':
paths_sums.cpp:56:12: error: invalid types 'int[int]' for array subscript
     viz[nod] = 1;

            ^
paths_sums.cpp:57:5: error: 'dp' was not declared in this scope
     dp[nod]  = 1;

     ^
paths_sums.cpp:58:9: error: 'p1' was not declared in this scope
     if(!p1[nod])

         ^
paths_sums.cpp:59:9: error: 'a' was not declared in this scope
         a[++ind] = nod,p1[nod] = ind;

         ^
paths_sums.cpp:61:5: error: 'sum' was not declared in this scope
     sum[nod] = normal[nod];

     ^
paths_sums.cpp:61:16: error: 'normal' was not declared in this scope
     sum[nod] = normal[nod];

                ^
paths_sums.cpp:62:18: error: 'M' was not declared in this scope
     for(auto i : M[nod])

                  ^
paths_sums.cpp:64:20: error: 'p1' was not declared in this scope
            if(ind!=p1[nod])

                    ^
paths_sums.cpp:65:13: error: 'a' was not declared in this scope
             a[++ind] = nod;

             ^
paths_sums.cpp:71:17: error: 'h' was not declared in this scope
                 h[i.first] = h[nod] + 1;

                 ^
paths_sums.cpp:75:16: error: 'dist' was not declared in this scope
                dist[i.first] = (dist[nod]%mod + i.second%mod)%mod;

                ^
paths_sums.cpp:87:13: error: 'p1' was not declared in this scope
     if(ind!=p1[nod])

             ^
paths_sums.cpp:88:5: error: 'a' was not declared in this scope
     a[++ind] = nod;

     ^
paths_sums.cpp: At global scope:
paths_sums.cpp:93:20: error: array bound is not an integer constant before ']' token
     int lg[2*nmax+1];

                    ^
paths_sums.cpp: In function 'void rmqini()':
paths_sums.cpp:98:13: error: 'rmq' was not declared in this scope
             rmq[0][i] = a[i];

             ^
paths_sums.cpp:98:25: error: 'a' was not declared in this scope
             rmq[0][i] = a[i];

                         ^
paths_sums.cpp:108:23: error: 'rmq' was not declared in this scope
                       rmq[p][i] = rmq[p-1][i];

                       ^
paths_sums.cpp:110:36: error: 'h' was not declared in this scope
                       if(j<=ind && h[rmq[p][i]]>h[rmq[p-1][j]])

                                    ^
paths_sums.cpp:118:11: error: 'lg' was not declared in this scope
           lg[1] = 0;

           ^
paths_sums.cpp: In function 'int lca(int, int)':
paths_sums.cpp:127:23: error: 'p1' was not declared in this scope
          int st = min(p1[x],p1[y]);

                       ^
paths_sums.cpp:129:20: error: 'lg' was not declared in this scope
          int val = lg[dr-st+1];

                    ^
paths_sums.cpp:131:13: error: 'h' was not declared in this scope
          if(h[rmq[val][st]]>h[rmq[val][dr-len+1]])

             ^
paths_sums.cpp:131:15: error: 'rmq' was not declared in this scope
          if(h[rmq[val][st]]>h[rmq[val][dr-len+1]])

               ^
paths_sums.cpp: In function 'int main()':
paths_sums.cpp:151:14: error: 'M' was not declared in this scope
              M[i+1].push_back({x,y});

              ^
paths_sums.cpp:156:20: error: invalid types 'int[int]' for array subscript
               viz[i] = 0;

                    ^
paths_sums.cpp:171:20: error: 'dist' was not declared in this scope
           baza = ((dist[u]%mod - dist[val]%mod)%mod + mod)%mod;

                    ^
paths_sums.cpp:174:19: error: 'dp' was not declared in this scope
            coef = dp[u] * dp[v];

                   ^
paths_sums.cpp:177:28: error: 'normal' was not declared in this scope
          cu = (dp[u]%mod * normal[u]%mod)%mod;

                            ^
paths_sums.cpp:178:18: error: 'sum' was not declared in this scope
           su = ((sum[u]%mod - cu%mod)%mod + mod)%mod;

                  ^
paths_sums.cpp: In function 'int lca(int, int)':
paths_sums.cpp:137:6: warning: control reaches end of non-void function [-Wreturn-type]
      }

      ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema paths_sums face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.