Detalii evaluare #41881087

Rezumat problemă

Ariciul Gălușcă este un arici obișnuit pe timp de zi. Noaptea, însă, el este de fapt eroul misterios al orașului Hedgytown – un oraș mai special, deoarece are clădiri atât deasupra solului, cât și sub pamânt, unde gravitația este inversată. Orașul poate fi văzut ca o dreaptă (ce reprezintă solul), cu un șir de clădiri dreptunghiulare lipite deasupra solului, și un șir de clădiri dreptunghiulare lipite dedesubtul solului. Sunt N clădiri peste pământ și M sub pământ. Cele două șiruri încep și se termină la aceleași poziții. Fiecare clădire este caracterizată de trei valori: L, H și E. L reprezintă lățimea clădirii, H reprezintă înălțimea clădirii și E reprezintă efortul necesar pentru a folosi liftul din acea clădire. Se cere să se afle numărul minim de unități de efort pe care trebuie să le depună ariciul Gălușcă pentru a ajunge la destinația sa.

Detalii

Problema superhedgy Operații I/O superhedgy.in/superhedgy.out
Limita timp 0.5 secunde Limita memorie Total: 512 MB / Stivă 64 MB
Id soluție #41881087 Utilizator Arseniu Victor Stefan (Vicarsen)
Fișier superhedgy.cpp Dimensiune 7.00 KB
Data încărcării 07 Februarie 2023, 13:02 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

superhedgy.cpp:8:18: warning: missing terminating ' character [enabled by default]
 #define NMAX (100'000)

                  ^
superhedgy.cpp:9:18: warning: missing terminating ' character [enabled by default]
 #define MMAX (100'000)

                  ^
superhedgy.cpp:38:5: error: missing terminating ' character
     } edges[3 * (NMAX + MMAX) + 2];

     ^
superhedgy.cpp:38:5: error: missing terminating ' character
superhedgy.cpp:43:5: error: missing terminating ' character
     int begin[NMAX + MMAX + 2];

     ^
superhedgy.cpp:43:5: error: missing terminating ' character
superhedgy.cpp:46:5: error: missing terminating ' character
     unsigned long long dist[NMAX + MMAX + 2];

     ^
superhedgy.cpp:46:5: error: missing terminating ' character
superhedgy.cpp:100:1: error: missing terminating ' character
 int l[NMAX + MMAX], h[NMAX + MMAX], e[NMAX + MMAX];

 ^
superhedgy.cpp:100:1: error: missing terminating ' character
superhedgy.cpp:100:1: error: missing terminating ' character
superhedgy.cpp:100:1: error: missing terminating ' character
superhedgy.cpp:100:1: error: missing terminating ' character
superhedgy.cpp:100:1: error: missing terminating ' character
superhedgy.cpp:38:34: error: expected ')' before ']' token
     } edges[3 * (NMAX + MMAX) + 2];

                                  ^
superhedgy.cpp:38:35: error: expected ')' before ';' token
     } edges[3 * (NMAX + MMAX) + 2];

                                   ^
superhedgy.cpp:38:35: error: expected ']' before ';' token
superhedgy.cpp:43:30: error: expected ')' before ']' token
     int begin[NMAX + MMAX + 2];

                              ^
superhedgy.cpp:43:31: error: expected ')' before ';' token
     int begin[NMAX + MMAX + 2];

                               ^
superhedgy.cpp:43:31: error: expected ']' before ';' token
superhedgy.cpp:46:44: error: expected ')' before ']' token
     unsigned long long dist[NMAX + MMAX + 2];

                                            ^
superhedgy.cpp:46:45: error: expected ')' before ';' token
     unsigned long long dist[NMAX + MMAX + 2];

                                             ^
superhedgy.cpp:46:45: error: expected ']' before ';' token
superhedgy.cpp: In function 'void add_edge(int, int, int)':
superhedgy.cpp:55:11: error: 'struct<anonymous>' has no member named 'edges'
     graph.edges[graph.m] = { v, w, graph.begin[u] };

           ^
superhedgy.cpp:55:42: error: 'struct<anonymous>' has no member named 'begin'
     graph.edges[graph.m] = { v, w, graph.begin[u] };

                                          ^
superhedgy.cpp:56:11: error: 'struct<anonymous>' has no member named 'begin'
     graph.begin[u] = graph.m++;

           ^
superhedgy.cpp: In function 'void dijkstra()':
superhedgy.cpp:66:11: error: 'struct<anonymous>' has no member named 'dist'
     graph.dist[0] = 0;

           ^
superhedgy.cpp:76:23: error: 'struct<anonymous>' has no member named 'dist'
         if(c != graph.dist[u])

                       ^
superhedgy.cpp:80:27: error: 'struct<anonymous>' has no member named 'begin'
         for(int i = graph.begin[u]; i != NONE; i = graph.edges[i].next)

                           ^
superhedgy.cpp:80:58: error: 'struct<anonymous>' has no member named 'edges'
         for(int i = graph.begin[u]; i != NONE; i = graph.edges[i].next)

                                                          ^
superhedgy.cpp:83:27: error: 'struct<anonymous>' has no member named 'edges'
             int v = graph.edges[i].v;

                           ^
superhedgy.cpp:84:27: error: 'struct<anonymous>' has no member named 'edges'
             int w = graph.edges[i].w;

                           ^
superhedgy.cpp:87:22: error: 'struct<anonymous>' has no member named 'dist'
             if(graph.dist[v] > graph.dist[u] + w)

                      ^
superhedgy.cpp:87:38: error: 'struct<anonymous>' has no member named 'dist'
             if(graph.dist[v] > graph.dist[u] + w)

                                      ^
superhedgy.cpp:89:23: error: 'struct<anonymous>' has no member named 'dist'
                 graph.dist[v] = graph.dist[u] + w;

                       ^
superhedgy.cpp:89:39: error: 'struct<anonymous>' has no member named 'dist'
                 graph.dist[v] = graph.dist[u] + w;

                                       ^
superhedgy.cpp:90:33: error: 'struct<anonymous>' has no member named 'dist'
                 pq.push({ graph.dist[v], v });

                                 ^
superhedgy.cpp:90:45: error: no matching function for call to 'std::priority_queue<std::pair<long long unsigned int, int>, std::vector<std::pair<long long unsigned int, int> >, std::greater<std::pair<long long unsigned int, int> > >::push(<brace-enclosed initializer list>)'
                 pq.push({ graph.dist[v], v });

                                             ^
superhedgy.cpp:90:45: note: candidates are:
In file included from /usr/include/c++/4.8/queue:64:0,
                 from superhedgy.cpp:2:
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long unsigned int, int>; _Sequence = std::vector<std::pair<long long unsigned int, int> >; _Compare = std::greater<std::pair<long long unsigned int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long unsigned int, int>]
       push(const value_type& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:496:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<long long unsigned int, int>&}'
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note: void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<long long unsigned int, int>; _Sequence = std::vector<std::pair<long long unsigned int, int> >; _Compare = std::greater<std::pair<long long unsigned int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long unsigned int, int>]
       push(value_type&& __x)
       ^
/usr/include/c++/4.8/bits/stl_queue.h:504:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long unsigned int, int>, std::vector<std::pair<long long unsigned int, int> >, std::greater<std::pair<long long unsigned int, int> > >::value_type&& {aka std::pair<long long unsigned int, int>&&}'
superhedgy.cpp: At global scope:
superhedgy.cpp:100:18: error: expected ')' before ']' token
 int l[NMAX + MMAX], h[NMAX + MMAX], e[NMAX + MMAX];

                  ^
superhedgy.cpp:100:51: error: expected ')' before ';' token
 int l[NMAX + MMAX], h[NMAX + MMAX], e[NMAX + MMAX];

                                                   ^
superhedgy.cpp:100:51: error: expected ']' before ';' token
superhedgy.cpp: In function 'void debug_print_graph()':
superhedgy.cpp:119:27: error: 'struct<anonymous>' has no member named 'begin'
         for(int i = graph.begin[u]; i != NONE; i = graph.edges[i].next)

                           ^
superhedgy.cpp:119:58: error: 'struct<anonymous>' has no member named 'edges'
         for(int i = graph.begin[u]; i != NONE; i = graph.edges[i].next)

                                                          ^
superhedgy.cpp:121:27: error: 'struct<anonymous>' has no member named 'edges'
             int v = graph.edges[i].v;

                           ^
superhedgy.cpp:122:27: error: 'struct<anonymous>' has no member named 'edges'
             int w = graph.edges[i].w;

                           ^
superhedgy.cpp: In function 'int main()':
superhedgy.cpp:149:28: error: 'l' was not declared in this scope
         scanf("%d %d %d", &l[i], &h[i], &e[i]);

                            ^
superhedgy.cpp:149:35: error: 'h' was not declared in this scope
         scanf("%d %d %d", &l[i], &h[i], &e[i]);

                                   ^
superhedgy.cpp:149:42: error: 'e' was not declared in this scope
         scanf("%d %d %d", &l[i], &h[i], &e[i]);

                                          ^
superhedgy.cpp:154:28: error: 'l' was not declared in this scope
         scanf("%d %d %d", &l[i + n], &h[i + n], &e[i + n]);

                            ^
superhedgy.cpp:154:39: error: 'h' was not declared in this scope
         scanf("%d %d %d", &l[i + n], &h[i + n], &e[i + n]);

                                       ^
superhedgy.cpp:154:50: error: 'e' was not declared in this scope
         scanf("%d %d %d", &l[i + n], &h[i + n], &e[i + n]);

                                                  ^
superhedgy.cpp:160:15: error: 'struct<anonymous>' has no member named 'begin'
         graph.begin[i] = NONE;

               ^
superhedgy.cpp:161:15: error: 'struct<anonymous>' has no member named 'dist'
         graph.dist[i] = INF;

               ^
superhedgy.cpp:167:26: error: 'h' was not declared in this scope
     add_edge(0, (0) + 1, h[0]);

                          ^
superhedgy.cpp:174:36: error: 'abs' was not declared in this scope
         int w = abs(h[i] - h[i - 1]);

                                    ^
superhedgy.cpp:174:36: note: suggested alternative:
In file included from superhedgy.cpp:3:0:
/usr/include/c++/4.8/cmath:99:5: note:   'std::abs'
     abs(_Tp __x)
     ^
superhedgy.cpp:184:44: error: 'abs' was not declared in this scope
         int w = abs(h[i + n] - h[i - 1 + n]);

                                            ^
superhedgy.cpp:184:44: note: suggested alternative:
In file included from superhedgy.cpp:3:0:
/usr/include/c++/4.8/cmath:99:5: note:   'std::abs'
     abs(_Tp __x)
     ^
superhedgy.cpp:196:29: error: 'l' was not declared in this scope
         if(overlap(x1, x1 + l[i], x2, x2 + l[j + n]))

                             ^
superhedgy.cpp:199:21: error: 'e' was not declared in this scope
             int w = e[i] + e[j + n];

                     ^
superhedgy.cpp:207:17: error: 'l' was not declared in this scope
         if(x1 + l[i] > x2 + l[j + n])

                 ^
superhedgy.cpp:237:15: error: 'l' was not declared in this scope
         lt += l[i];

               ^
superhedgy.cpp:240:33: error: 'struct<anonymous>' has no member named 'dist'
     printf("%lld\n", lt + graph.dist[graph.n - 1]);

                                 ^
superhedgy.cpp:143:41: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("superhedgy.in", "r", stdin);

                                         ^
superhedgy.cpp:144:43: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("superhedgy.out", "w", stdout);

                                           ^
superhedgy.cpp:147:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);

                    ^
superhedgy.cpp:152:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &m);

                    ^

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 superhedgy 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ă.