#include #include #include #include #include #include #include #include #include #include using namespace std; using namespace chrono; #define official #ifdef official #define cin inF #define cout outF #endif ifstream inF("drawing.in"); ofstream outF("drawing.out"); const int MAX_N=512; const int MAX_K=16; int RES=900; int RES0=0; const int MAX_RES=1024; int STEPS=5; const int MAX_STEPS=16; const double EPS=1e-12; double POW1=1.5;//2; double POW2=3;//4; int PROB1=3; int startPoint=-1; struct Color { double r,g,b; }; bool operator<(const Color& a, const Color& b) { return a.r+a.g+b.g>b.r+b.g+b.b; } Color operator+(const Color& a, const Color& b) { Color r; r.r=a.r+b.r; r.g=a.g+b.g; r.b=a.b+b.b; return r; } Color operator*(const Color& a, double b) { Color r; r.r=a.r*b; r.g=a.g*b; r.b=a.b*b; return r; } Color operator/(const Color& a, double b) { Color r; r.r=a.r/b; r.g=a.g/b; r.b=a.b/b; return r; } Color floor(const Color& a) { Color r; r.r=floor(a.r); r.g=floor(a.g); r.b=floor(a.b); return r; } double diff2(const Color& a, const Color& b) { double d=(a.r-b.r)*(a.r-b.r)+(a.g-b.g)*(a.g-b.g)+(a.b-b.b)*(a.b-b.b); return d; } double diff(const Color& a, const Color& b) { return sqrt(diff2(a,b)); } struct ResultingColor { Color c; int type; int steps[MAX_STEPS*2]; }; bool operator<(const ResultingColor& a, const ResultingColor& b) { return a.c units; vector units2; vector inGroup[MAX_RES]; int wx,wy,ox,oy; int wi=-1; bool used[MAX_N][MAX_N]; int OPERATIONS=0; void input() { cin>>n>>k; for (int i=0; i>p[i].r>>p[i].g>>p[i].b; } for (int i=0; i>d[i][j].r; } } for (int i=0; i>d[i][j].g; } } for (int i=0; i>d[i][j].b; } } } void getResulting1(int num, const Color& curr, int x, int y) { int mj; double cd; double pr[MAX_K]; double cpr; double tp; Color cc=curr/(1<=0; --i) { coeff*=2; tp=0; total+=1.0/coeff; for (int j=startPoint; j=0; --i) { coeff*=2; tp=0; total+=1.0/coeff; for (int j=startPoint; j=0; --i) { if (!inGroup[i].empty()) { lastGroup=i; last=r[i].c; wx=inGroup[i][0].x; wy=inGroup[i][0].y; if (inGroup[i].size()>1) { ox=inGroup[i][1].x; oy=inGroup[i][1].y; } else if (inGroup[i][0].type!=0) { if (inGroup[i][0].type==1) { ox=wx+1; oy=wy; } else { ox=wx; oy=wy+1; } } else { for (int j=i-1; j>=0; --j) { if (!inGroup[j].empty()) { ox=inGroup[i][0].x; oy=inGroup[i][0].y; break; } } } break; } } } void findOperations() { OPERATIONS=units.size(); for (int i=0; i<=lastGroup; ++i) { //if (!inGroup[i].empty()) { if (r[i].type==1) OPERATIONS+=STEPS; else OPERATIONS+=2*STEPS+2; } } } void outputGroup(int num) { //if (inGroup[num].empty()) return; if (r[num].type==1) { for (int i=0; i150) //rand { RES=900; STEPS=4; POW1=7; PROB1=1; if (k==2 && startPoint==0) //bw { doAll=1; STEPS=7; RES=1<32.5 && avgdiff<42.5 && zerodiffs>70000 && zerodiffs<80000) { //2rand RES=900; STEPS=8; POW1=10; POW2=10; PROB1=100; if (k==2) { startPoint=0; doAll=1; RES0=1<65 && avgdiff<75 && zerodiffs>70000 && zerodiffs<80000) { //2rand rgb RES=900; STEPS=8; POW1=3.5; POW2=7; PROB1=20; } else //if (k==5 && startPoint==0) { //rgb RES=900; STEPS=5; POW1=8; POW2=8; PROB1=100; if (k==2) { doAll=2; RES0=243; } } } void isWhite() { startPoint=-1; for (int i=0; ip[wi].r+p[wi].g+p[wi].b) { wi=i; } } } } void solve() { isWhite(); findUnits1(); cerr<<"average difference: "<>(currT-startT).count()<