#include using namespace std; int W,H,W1,H1,Q; int BrColCells[509][509]; struct slog{ int red,green,blue,brkorisnika; bool upotreba; }; int K=5; bool imanje[256][256][256]; long long score; long long minscore=10000000009; slog cells[1009][1009],BestPaleta[10009],Paleta[10009]; int Boja[256][256][256]; vectorP,VPaleta; //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// bool cmp1(slog a,slog b){ return a.brkorisnika>b.brkorisnika; }; void izracunaj_score(){ int M=VPaleta.size(); for(int p=0; p0){ slog SL; SL.red=r; SL.green=g; SL.blue=b; SL.brkorisnika=Boja[r][g][b]; VPaleta.push_back(SL); } } } } sort(VPaleta.begin(),VPaleta.end(),cmp1); for(int t=1; t<=100; t++){ memset(imanje,0,sizeof(imanje)); for(int i=0; i<16; i++){ int x=rand()%(P.size()); int r=P[x].red; int g=P[x].green; int b=P[x].blue; while(imanje[r][g][b]==true){ x=rand()%(P.size()); r=P[x].red; g=P[x].green; b=P[x].blue; } Paleta[i].red=r; Paleta[i].green=g; Paleta[i].blue=b; imanje[r][g][b]=true; } score=0; izracunaj_score(); if(score>cells[h][w].red; cin>>cells[h][w].green; cin>>cells[h][w].blue; } }; void ispis_palete(){ for(int i=0; i<16; i++) cout<>W>>H; unos_slike(); }; void FirstAlgorithm(){ upis_palete(); }; void FirstOutput(){ ispis_palete(); ispis_odabira_boja(); }; //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// void SecondInput(){ for(int i=0; i<=15; i++){ cin>>Paleta[i].red; cin>>Paleta[i].green; cin>>Paleta[i].blue; } cin>>W1>>H1; for(int h=1; h<=H1; h++) for(int w=1; w<=W1; w++) cin>>BrColCells[h][w]; }; void SecondAlgorithm(){ }; void SecondOutput(){ for(int h=1; h<=H1; h++){ for(int w=1; w<=W1; w++){ cout<>Q; if(Q==0){ FirstInput(); FirstAlgorithm(); FirstOutput(); } if(Q==1){ SecondInput(); SecondAlgorithm(); SecondOutput(); } return 0; }