Rezultati

Up. imeNalogaJezikRezultatČas oddaje
Deathmask Kvadrat števil C++ 100/100OK 13. okt '18 @ 13:22

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 3,004 MiB 0,004 s OK
#2 10/10 3,145 MiB 0,000 s OK
#3 10/10 3,145 MiB 0,000 s OK
#4 10/10 3,152 MiB 0,000 s OK
#5 10/10 3,016 MiB 0,009 s OK
#6 10/10 3,164 MiB 0,009 s OK
#7 10/10 3,066 MiB 0,105 s OK
#8 10/10 3,070 MiB 0,093 s OK
#9 10/10 3,066 MiB 0,099 s OK
#10 10/10 3,223 MiB 0,098 s OK

Ocenjevani program (main.cpp):
#include <iostream>
using namespace std;

void ms(int Arr[], int n){

    for (int i=0;i<n;i++){

        int mini=i;
        for (int j=i;j<n;j++){

            if (Arr[j]>Arr[mini]){
                mini=j;
            }

        }
        swap(Arr[i],Arr[mini]);
    }


}
int main()
{

    int n, c=0, tmp=0;
    cin>>n;
    int a[n*n];
    for(int i=0;i<n*n;i++){
        cin>>a[i];
    }
    ms(a, n*n);
    int mat[n][n];
    int row=n/2;
    int col=row;
    int m=n*n;
    int cl=0;
    int time =0;
    for (int i=0;i<m;i++){
          if (time%2==0){
            row=n/2+cl;
            cl++;
          }
          else{
          row=n/2-cl;
          }

        mat[row][col]=a[i];
        int j=1;;
        while (j<=n/2){

            mat[row][col+j]=a[i+1];
            mat[row][col-j]=a[i+2];
            j++;
            i=i+2;
        }
    time++;
    }

    for (int i=0;i<n;i++){

            for (int j=0;j<n;j++){

                cout<<mat[i][j]<<" ";
            }
            cout<<endl;
    }

}