#include #include #include using namespace std; #if !LOCALTEST #undef assert #define assert(...) (void)0 #endif #define T 3600 #define N 5400 int const di[]={0,464,1008,1624,2296,3046,3842,4820,5869,7124,8444,9893,11469,13291,15269,17464,19858,22407,25211,28244,31439,34949,38849,42929,47339,52089,57066,62394,68005,73919,80095,86765,93683,100855,108417,116283,124706,133132,141979,151078,160492,170288,180096,190140,200423,210928,221280,232133,242922,253760,264610,275390,286240,297078,307867,318720,329072,339577,349860,359904,369712,379508,388922,398021,406868,415294,423717,431583,439145,446317,453235,459905,466081,471995,477606,482934,487911,492661,497071,501151,505051,508561,511756,514789,517593,520142,522536,524731,526709,528531,530107,531556,532876,534131,535180,536158,536954,537704,538376,538992,539536}; struct CGroup{ int ni; int ma; int hi; int pe; }; CGroup g[101]; struct UV { int u,v; }; UV uv[5555]; long m; int oldness(long j,long t){ return t-g[j].pe/g[j].ni; } int add(long j,long p,long s,long t){ assert(g[j].ni>0); assert(g[j].ni<4); if(0){ return 0; } uv[m].u=g[j].hi; uv[m].v=p; ++m; if(g[j].ni==3){ g[j].ni=0; }else{ if(sg[j].ma){ g[j].ma=s; } g[j].ni+=1; g[j].pe+=t; } return 1; } double calcdd(double d,double h){ return pow(d,1.5)*pow(h/N,0.5); } main(){ { long t; scanf("%ld",&t); assert(t==T); } { long r; scanf("%ld",&r); assert(r==4); } double fq=double(N)/double(T); long p=0; for(long t=0;t=0); assert(n<=5400); fq=(fq*39+n)/40; for(long i=0;i=0); assert(s<=100); double best_dd=25.0/((0.85+fq/(double(N)/double(T)))/1.85); long best_j=-1; long incl_j=-1; for(long j=0;j<=100;++j){ if(g[j].ni){ if(oldness(j,t)>150){ g[j].ni=0; }else{ long d,h; if(sg[j].ma){ d=s-j; h=di[s]-di[j]; }else{ d=g[j].ma-j; h=di[g[j].ma]-di[j]; assert(incl_j<0); incl_j=j; } double dd=calcdd(d,h)-calcdd(g[j].ma-j,di[g[j].ma]-di[j]); dd*=pow(double(g[j].ni),0.9)+0.30; if(dd=0&&incl_j!=best_j){ g[incl_j].ni=0; } if(best_j>=0){ if(add(best_j,p,s,t)){ goto hoge; } } if(incl_j>=0){ g[incl_j].ni=0; } { assert(g[s].ni==0); g[s].ni=1; g[s].hi=p; g[s].ma=s; g[s].pe=t; } hoge:; } printf("%d\n",m); for(long k=0;k