CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • February CookOff
    • February Long Contest
    • January CookOff
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
    • Event Calendar
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Ranks
    • Tutorials
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home  » Codechef Campus Snackdown » The Matrix Game » All Submissions » moneymachine [136782]
0
Your rating: None

CodeChef submission 136782 (C++ 4.3.2)

CodeChef submission 136782 (C++ 4.3.2) plaintext list. Status: WA, problem SNCK01, contest SNACKDWN. By neoalgorist (neoalgorist), 2009-11-21 23:56:53.
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<iterator>
  4. #include<map>
  5. #include<vector>
  6. #include<list>
  7. #include<set>
  8. #include<queue>
  9. #include<deque>
  10. #include<stack>
  11. #include<bitset>
  12. #include<functional>
  13. #include<utility>
  14. #include<fstream>
  15. #include<iosfwd>
  16. #include<sstream>
  17. #include<iomanip>
  18. #include<string>
  19. #include<cmath>
  20. #include<cstring>
  21. #include<ctime>
  22. #include<cstdio>
  23. #include<cstring>
  24. #include<cstdlib>
  25. #include<cctype>
  26. #include<cassert>
  27. #include<complex>
  28. #include<numeric>
  29.  
  30. using namespace std;
  31.  
  32. #define DEBUG 0
  33. #define BUG(x) cout<<"Debugging Variable "<< #x <<endl
  34. #define SYS system("pause")
  35. #define VAR(x,a) __typeof(a) x(a)
  36. #define FORD(i,a,b) for(int i = (int)a,_b = (int)b;i>=(_b);--i)
  37. #define FOREACH(it,v) for(VAR(it,(v).begin());it!=(v).end();++it)
  38. #define FOR(i,a,b) for(int i=(int)(a),_b = (int)b;i<(int)(_b);++i)
  39. #define REP(i,n) FOR(i,0,n)
  40. #define REPD(i,n) FORD(i,n,0)
  41. #define Size() size()
  42. #define PB push_back
  43. #define PF push_front
  44. #define MP make_pair
  45. #define SZ size()
  46. #define ALL(X) X.begin(),X.end()
  47. #define RALL(X) X.rbegin(),X.rend()
  48. #define Clear(X) memset(X,0,sizeof(X))
  49. #define PushBack push_back
  50. #define PushFront push_front
  51. #define MakePair make_pair
  52. #define PopBack pop_back
  53. #define PopFront pop_front
  54. #define BitCount __builtin_popcount
  55. #define INF 100000000
  56. #define INFLL 10000000000000000LL
  57.  
  58. typedef vector< int > VI;
  59. typedef vector< double > VD;
  60. typedef vector< string > VS;
  61. typedef vector< char > VC;
  62. typedef vector< long double > VLD;
  63. typedef vector< long long > VLL;
  64. typedef vector< vector< int > > VVI;
  65. typedef vector< pair< int,int > > VPII;
  66. typedef vector< vector< double > > VVD;
  67. typedef vector< vector< char > > VVC;
  68. typedef vector< vector< string > > VVS;
  69. typedef vector< vector< long long > > VVLL;
  70. typedef string SS;
  71. typedef unsigned long long ULL;
  72. typedef long long LL;
  73. typedef long double LD;
  74. typedef pair< int,int > PII;
  75. typedef unsigned long UL;
  76.  
  77. int RInt(){int N;scanf("%d",&N);return N;}
  78. SS RSS(){SS S;cin>>S;return S;}
  79. LL RLL(){LL N;cin>>N;return N;}
  80. VI RVInt(int N){VI V(N,0);for(int i=0;i<N;++i)scanf("%d",&V[i]);return V;}
  81.  
  82. void DInt(int X){cout<<"Value Of Variable = "<<X<<endl;}
  83. void DSS(SS S){cout<<"String is "<<S<<endl;}
  84. void DVInt(VI V){cout<<"Vector Size = "<<V.SZ<<endl;cout<<"Elements "<<endl;REP(i,V.SZ)cout<<V[i]<<" ";cout<<endl;}
  85. void DLL(LL X){cout<<"Value Of Variable = "<<X<<endl;}
  86.  
  87. char *RESULT(int a[50][50],int n,int m);
  88. int row,col;
  89. int check(int a[50][50],int n,int m);
  90. int VAL(int a[50][50],int n,int m);
  91.  
  92.  
  93. int main()
  94. {
  95. int T=RInt();
  96. int S[50][50];
  97. while(T--) {
  98. int N=RInt(),M=RInt();
  99. int rest=0;
  100. int no1=0;
  101. int c[50][2]={0};
  102. REP(i,N)
  103. REP(j,M) {
  104. S[i][j]=RInt();
  105. if(S[i][j]%2==0)
  106. c[j][1]++;
  107. else
  108. c[j][0]++;
  109. }
  110. REP(i,M)
  111. if(c[i][0]>c[i][1])
  112. no1++;
  113. else
  114. rest++;
  115. if(no1>rest)
  116. printf("FIRST\n");
  117. else
  118. printf("SECOND\n");
  119. }
  120. return 0;
  121. }
  122.  
  123.  
  124. /*
  125. int check(int a[50][50],int n,int m) {
  126. int found=0;
  127. REP(i,n)
  128. REP(j,m)
  129. if(a[i][j]!=0) {
  130. found=1;
  131. break;
  132. }
  133. if(found)
  134. return 1;
  135. else
  136. return 0;
  137. }
  138.  
  139. int VAL(int a[50][50],int n,int m) {
  140. int max=0;
  141. REP(i,n)
  142. REP(j,m) {
  143. int lm=0;
  144. if(a[i][j]!=0)
  145. lm=1;
  146. if(max<a[i][j]) {
  147. max=a[i][j];
  148. row=i;
  149. col=j;
  150. }
  151. if(lm!=0)
  152. break;
  153. }
  154. return max;
  155. }
  156. char *RESULT(int a[50][50],int n,int m) {
  157. int chance=0;
  158. while(chance<(n*m)) {
  159. chance++;
  160. int pick=VAL(a,n,m);
  161. // chance+=pick;
  162. a[row][col]=0;
  163. for(int k=1;k<pick;k++) {
  164. chance++;
  165. int var=0,x,l;
  166. for(l=col+1;l<m;l++) {
  167. if(var<a[row][l]) {
  168. var=a[row][l];
  169. x=l;
  170. }
  171. }
  172. a[row][l]=0;
  173. }
  174. }
  175. chance=chance%2;
  176. if(chance)
  177. return "FIRST";
  178. else
  179. return "SECOND";
  180. }
  181. */


Comments

  • Login or Register to post a comment.

CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of computer programming. At CodeChef we work hard to revive the geek in you by hosting programming contests on a monthly basis. We also aim to have training sessions and events related to online programming for programmers around the world. Apart from providing a platform for programming competitions, CodeChef also has various tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our judge accepts solutions in over 35+ programming languages. Online programming was never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming competitions that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly programming contests and the shorter format Cook-off programming contests. Put yourself up for recognition and win great prizes. Prizes worth up to Rs.20,000 and $700 are up for grabs every month along with lots more CodeChef goodies.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be part of CodeChefs Forums and interact with all our programmers love helping out other programmers and share their ideas.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. Be a part of the CodeChef community through CodeChef meetups and techtalks. You can also host a programming contest for your institute on CodeChef and be a guest author on our blog.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com