Detalii evaluare #42933881

Rezumat problemă

O matrice pătratică de dimensiuni N x N cu liniile și coloanele indexate de la 1 la N se numește matrice șmecheră de Calafat dacă pe fiecare linie și fiecare coloană există exact două valori de 1, restul elementelor fiind 0.

Având două matrice șmechere de Calafat notate cu A și B, se cere ca prin interschimbări de linii și coloane să se transforme matricea B în matricea A.

ONI 2016, clasele XI-XII

Detalii

Problema Transform Operații I/O transform.in/transform.out
Limita timp 1.5 secunde Limita memorie Total: 128 MB / Stivă 128 MB
Id soluție #42933881 Utilizator Gheorghies Alexandru (andu2006)
Fișier transform.cpp Dimensiune 2.90 KB
Data încărcării 23 Martie 2023, 08:56 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

transform.cpp:7:20: error: expected initializer before 'NMAX'
 const long long ll NMAX=2e5+5;

                    ^
transform.cpp:10:7: error: 'NMAX' was not declared in this scope
 ll xa[NMAX],ya[NMAX],xb[NMAX],yb[NMAX];

       ^
transform.cpp:10:16: error: 'NMAX' was not declared in this scope
 ll xa[NMAX],ya[NMAX],xb[NMAX],yb[NMAX];

                ^
transform.cpp:10:25: error: 'NMAX' was not declared in this scope
 ll xa[NMAX],ya[NMAX],xb[NMAX],yb[NMAX];

                         ^
transform.cpp:10:34: error: 'NMAX' was not declared in this scope
 ll xa[NMAX],ya[NMAX],xb[NMAX],yb[NMAX];

                                  ^
transform.cpp:11:12: error: 'NMAX' was not declared in this scope
 ll targetx[NMAX],targety[NMAX];

            ^
transform.cpp:11:26: error: 'NMAX' was not declared in this scope
 ll targetx[NMAX],targety[NMAX];

                          ^
transform.cpp:13:9: error: 'NMAX' was not declared in this scope
 ll edgx[NMAX],edgy[NMAX];

         ^
transform.cpp:13:20: error: 'NMAX' was not declared in this scope
 ll edgx[NMAX],edgy[NMAX];

                    ^
transform.cpp:14:9: error: 'NMAX' was not declared in this scope
 ll posx[NMAX],posy[NMAX];

         ^
transform.cpp:14:20: error: 'NMAX' was not declared in this scope
 ll posx[NMAX],posy[NMAX];

                    ^
transform.cpp:16:10: error: 'NMAX' was not declared in this scope
 ll edgx2[NMAX],edgy2[NMAX];

          ^
transform.cpp:16:22: error: 'NMAX' was not declared in this scope
 ll edgx2[NMAX],edgy2[NMAX];

                      ^
transform.cpp:17:10: error: 'NMAX' was not declared in this scope
 ll posx2[NMAX],posy2[NMAX];

          ^
transform.cpp:17:22: error: 'NMAX' was not declared in this scope
 ll posx2[NMAX],posy2[NMAX];

                      ^
transform.cpp:18:14: error: 'NMAX' was not declared in this scope
 bool visited[NMAX],visited2[NMAX];

              ^
transform.cpp:18:29: error: 'NMAX' was not declared in this scope
 bool visited[NMAX],visited2[NMAX];

                             ^
transform.cpp: In function 'void dfs(ll)':
transform.cpp:21:5: error: 'visited' was not declared in this scope
     visited[u]=1;

     ^
transform.cpp:23:17: error: 'edgx' was not declared in this scope
     if(!visited[edgx[u]]) dfs(edgx[u]);

                 ^
transform.cpp:24:17: error: 'edgy' was not declared in this scope
     if(!visited[edgy[u]]) dfs(edgy[u]);

                 ^
transform.cpp: In function 'void dfs1(ll)':
transform.cpp:27:5: error: 'visited' was not declared in this scope
     visited[u]=1;

     ^
transform.cpp:29:17: error: 'edgx2' was not declared in this scope
     if(!visited[edgx2[u]]) dfs1(edgx2[u]);

                 ^
transform.cpp:30:17: error: 'edgy2' was not declared in this scope
     if(!visited[edgy2[u]]) dfs1(edgy2[u]);

                 ^
transform.cpp: In function 'void dfs2(ll, ll)':
transform.cpp:33:5: error: 'targetx' was not declared in this scope
     targetx[xb[u]]=xa[v];

     ^
transform.cpp:33:13: error: 'xb' was not declared in this scope
     targetx[xb[u]]=xa[v];

             ^
transform.cpp:33:20: error: 'xa' was not declared in this scope
     targetx[xb[u]]=xa[v];

                    ^
transform.cpp:34:5: error: 'targety' was not declared in this scope
     targety[yb[u]]=ya[v];

     ^
transform.cpp:34:13: error: 'yb' was not declared in this scope
     targety[yb[u]]=ya[v];

             ^
transform.cpp:34:20: error: 'ya' was not declared in this scope
     targety[yb[u]]=ya[v];

                    ^
transform.cpp:35:5: error: 'visited2' was not declared in this scope
     visited2[u]=1;

     ^
transform.cpp:36:18: error: 'edgx2' was not declared in this scope
     if(!visited2[edgx2[u]]) dfs2(edgx2[u],edgx[v]);

                  ^
transform.cpp:36:43: error: 'edgx' was not declared in this scope
     if(!visited2[edgx2[u]]) dfs2(edgx2[u],edgx[v]);

                                           ^
transform.cpp:37:18: error: 'edgy2' was not declared in this scope
     if(!visited2[edgy2[u]]) dfs2(edgy2[u],edgy[v]);

                  ^
transform.cpp:37:43: error: 'edgy' was not declared in this scope
     if(!visited2[edgy2[u]]) dfs2(edgy2[u],edgy[v]);

                                           ^
transform.cpp: At global scope:
transform.cpp:39:26: error: 'NMAX' was not declared in this scope
 vector<ll> cycle_leaders[NMAX];

                          ^
transform.cpp: In function 'int main()':
transform.cpp:45:14: error: 'xa' was not declared in this scope
         fin>>xa[i]>>ya[i];

              ^
transform.cpp:45:21: error: 'ya' was not declared in this scope
         fin>>xa[i]>>ya[i];

                     ^
transform.cpp:46:12: error: 'posx' was not declared in this scope
         if(posx[xa[i]]!=0)

            ^
transform.cpp:47:13: error: 'edgx' was not declared in this scope
             edgx[posx[xa[i]]]=i,edgx[i]=posx[xa[i]];

             ^
transform.cpp:50:12: error: 'posy' was not declared in this scope
         if(posy[ya[i]]!=0)

            ^
transform.cpp:51:13: error: 'edgy' was not declared in this scope
             edgy[posy[ya[i]]]=i,edgy[i]=posy[ya[i]];

             ^
transform.cpp:56:13: error: 'visited' was not declared in this scope
         if(!visited[i])

             ^
transform.cpp:57:20: error: 'cycle_leaders' was not declared in this scope
             dfs(i),cycle_leaders[curr_cycle].push_back(i),curr_cycle=0;

                    ^
transform.cpp:60:14: error: 'xb' was not declared in this scope
         fin>>xb[i]>>yb[i];

              ^
transform.cpp:60:21: error: 'yb' was not declared in this scope
         fin>>xb[i]>>yb[i];

                     ^
transform.cpp:61:12: error: 'posx2' was not declared in this scope
         if(posx2[xb[i]]!=0)

            ^
transform.cpp:62:13: error: 'edgx2' was not declared in this scope
             edgx2[posx2[xb[i]]]=i,edgx2[i]=posx2[xb[i]];

             ^
transform.cpp:65:12: error: 'posy2' was not declared in this scope
         if(posy2[yb[i]]!=0)

            ^
transform.cpp:66:13: error: 'edgy2' was not declared in this scope
             edgy2[posy2[yb[i]]]=i,edgy2[i]=posy2[yb[i]];

             ^
transform.cpp:70:12: error: 'visited' was not declared in this scope
     memset(visited,0,sizeof visited);

            ^
transform.cpp:75:20: error: 'cycle_leaders' was not declared in this scope
             dfs2(i,cycle_leaders[curr_cycle].back());

                    ^
transform.cpp:87:19: error: 'targetx' was not declared in this scope
                 u=targetx[u];

                   ^
transform.cpp:90:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(ll j=1;j<cycle.size();j++){

                                 ^
transform.cpp:102:19: error: 'targety' was not declared in this scope
                 u=targety[u];

                   ^
transform.cpp:105:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(ll j=1;j<cycle.size();j++){

                                 ^

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