#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define c 9999999999 using namespace std; long long n,ans[501][501],m,tmn,tans,fl,cr,nom; struct tel{ long long r,g,b; }; tel a[17],p,b[501][501]; void funk1(){ int i,j,f; cin>>m>>n; p.r=255; p.g=p.b=0; a[0]=p;//red p.b=127; a[1]=p;//rose p.b=255; a[2]=p;//magenta p.r=127; a[3]=p;//violet p.r=0; a[4]=p;//blue p.g=127; a[5]=p;//azure p.g=255; a[6]=p;//cyan p.b=127; a[7]=p;//aquamarine p.b=0; a[8]=p;//green p.r=127; a[9]=p;//chartreuse p.r=255;a[10]=p;//yellow p.g=127;a[11]=p;//orange p.r=p.g=p.b=255; a[12]=p;//white p.r=p.g=p.b=127; a[13]=p;//gray p.r=p.g=p.b=0; a[14]=p;//black p.r=rand()%128+128; p.g=rand()%128+128; p.b=rand()%128+128; a[15]=p; for(i=0;i<16;i++)cout<>m>>n; for(i=1;i<=n;i++){ for(j=1;j<=m;j++){ scanf("%lld",&nom); b[i][j]=a[nom]; } } for(i=1;i<=n;i++){ for(j=1;j<=m;j++)cout<>fl; if(fl==0) funk1(); else funk2(); return 0; } /* 0 4 2 227 103 14 227 131 14 199 18 8 230 57 48 36 221 224 72 94 94 59 64 64 14 230 21 1 255 0 0 255 0 127 255 0 255 127 0 255 0 0 255 0 127 255 0 255 255 0 255 127 0 255 0 127 255 0 255 255 0 255 127 0 255 255 255 127 127 127 0 0 0 102 51 0 4 2 11 11 0 0 6 13 15 8 */