CodeChef submission 131091 (C++ 4.0.0-8) plaintext list. Status: AC, problem JX, contest NOV09. By Shitij (Shitij), 2009-11-11 14:59:10.
#include <iostream> #include <cstdlib> #include <algorithm> #include <ctime> using namespace std; int arr[502][502]; int b_factors[502]; struct song { int song_pop,song_no; }; bool operator < (const song &a,const song& b) { return a.song_pop>b.song_pop; } song song_p[502]; song list[502]; int main() { int d,s,i,j,temp,avg=0,d_temp,k; for(i=0;i<d;i++)//input boredom factors { } d_temp=d; int n0=0; for(i=0;i<d;i++)//input the 1-0 array { for(j=0;j<s;j++) { if(arr[i][j]==0) n0++; } if(n0>=b_factors[i]) avg+=b_factors[i]; else d_temp--; } avg/=d_temp; for(j=0;j<s;j++)//find column sums (song popularity) for(i=0;i<d;i++) arr[d][j]+=arr[i][j]; for(i=0;i<s;i++) { song_p[i].song_no=i; song_p[i].song_pop=arr[d][i]; } sort(song_p,song_p+s); int x; if(s>=10 && s<=100)//5-10 if(x<5) x+=5; avg=s/x; } else if(s>=100 && s<=200)//8-15 if(x<8) x+=8; avg=s/x; } else if(s>=200 && s<=300)//10-15 if(x<10) x+=10; avg=s/x; } else if(s>=300 && s<=400)//15-20 if(x<15) x+=15; avg=s/x; } else if(s>400)//17-24 if(x<17) x+=17; avg=s/x; } for(j=0;j<avg;j++) return 0; }
Comments

