#include #include #include #include #include #include using namespace std; const double TL = 4.5; bool TimeIsOK() { return (double)clock() / (double)CLOCKS_PER_SEC < TL; } int n,m,b; int nums[1011][1011]; int maxVal = 0; vector bestChoice; int val = 0; vector choice; int current[1011]; void optimal() { int i,j,in; for (i=0;i<(1< 0 ) { choice.push_back(j); for (in=1;in<=m;in++) { current[in] += nums[j][in]; } } } val = 0; for (j=1;j<=m;j++) { current[j] %= b; val += current[j] * current[j]; } if (val > maxVal) { bestChoice = choice; maxVal = val; } } printf("%d\n",(int)bestChoice.size()); for (i=0;i maxVal) { bestChoice.clear(); maxVal = val; for (i=1;i<=n;i++) { if (active[i]) { bestChoice.push_back(i); } } } } printf("%d\n",(int)bestChoice.size()); for (i=0;i