CodeChef submission 136758 (C++ 4.3.2) plaintext list. Status: WA, problem SNCK01, contest SNACKDWN. By neoalgorist (neoalgorist), 2009-11-21 23:54:57.
#include<iostream> #include<algorithm> #include<iterator> #include<map> #include<vector> #include<list> #include<set> #include<queue> #include<deque> #include<stack> #include<bitset> #include<functional> #include<utility> #include<fstream> #include<iosfwd> #include<sstream> #include<iomanip> #include<string> #include<cmath> #include<cstring> #include<ctime> #include<cstdio> #include<cstring> #include<cstdlib> #include<cctype> #include<cassert> #include<complex> #include<numeric> using namespace std; #define DEBUG 0 #define BUG(x) cout<<"Debugging Variable "<< #x <<endl #define SYS system("pause") #define VAR(x,a) __typeof(a) x(a) #define FORD(i,a,b) for(int i = (int)a,_b = (int)b;i>=(_b);--i) #define FOREACH(it,v) for(VAR(it,(v).begin());it!=(v).end();++it) #define FOR(i,a,b) for(int i=(int)(a),_b = (int)b;i<(int)(_b);++i) #define REP(i,n) FOR(i,0,n) #define REPD(i,n) FORD(i,n,0) #define Size() size() #define PB push_back #define PF push_front #define MP make_pair #define SZ size() #define ALL(X) X.begin(),X.end() #define RALL(X) X.rbegin(),X.rend() #define Clear(X) memset(X,0,sizeof(X)) #define PushBack push_back #define PushFront push_front #define MakePair make_pair #define PopBack pop_back #define PopFront pop_front #define BitCount __builtin_popcount #define INF 100000000 #define INFLL 10000000000000000LL typedef vector< int > VI; typedef vector< double > VD; typedef vector< string > VS; typedef vector< char > VC; typedef vector< long double > VLD; typedef vector< long long > VLL; typedef vector< vector< int > > VVI; typedef vector< pair< int,int > > VPII; typedef vector< vector< double > > VVD; typedef vector< vector< char > > VVC; typedef vector< vector< string > > VVS; typedef vector< vector< long long > > VVLL; typedef string SS; typedef unsigned long long ULL; typedef long long LL; typedef long double LD; typedef pair< int,int > PII; typedef unsigned long UL; int RInt(){int N;scanf("%d",&N);return N;} SS RSS(){SS S;cin>>S;return S;} LL RLL(){LL N;cin>>N;return N;} void DInt(int X){cout<<"Value Of Variable = "<<X<<endl;} void DSS(SS S){cout<<"String is "<<S<<endl;} void DVInt(VI V){cout<<"Vector Size = "<<V.SZ<<endl;cout<<"Elements "<<endl;REP(i,V.SZ)cout<<V[i]<<" ";cout<<endl;} void DLL(LL X){cout<<"Value Of Variable = "<<X<<endl;} string Result(VVI &S,int Row,int Col); bool AllZero(VVI &S); int GetCount(VVI &S); int main() { int T=RInt(); while(T--) { int N=RInt(),M=RInt(); VVI S; S.resize(N,VI(M,0)); REP(i,N) REP(j,M) S[i][j]=RInt(); cout<<Result(S,N,M)<<endl; } return 0; } string Result(VVI &S,int Row,int Col) { int Winner=0; int Count=0; REP(i,Row) { int j=0; while(j<Col&&S[i][j]<=1) { Count+=S[i][j]; S[i][j]=0; j++; } } Winner=Count%2+1; Count=0; REP(i,Row) REP(j,Col) if(S[i][j]>1) { Count++; break; } Winner=(Winner+Count%2)%2; if(Winner==1) return "SECOND"; else return "FIRST"; } int GetCount(VVI &S) { int Count=0; REP(i,S.SZ) REP(j,S[i].SZ) if(S[i][j]>0) Count++; return Count; }
Comments

