CodeChef submission 806057 (C++ 4.3.2) plaintext list. Status: TLE, problem TAKEAWAY, contest COOK18. By farhadi (farhadi), 2012-01-22 23:52:55.
//In the name of Allah // // ////////////////////// // Program: // Written By Alireza Farhadi (LGM) ////////////////////// #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cctype> #include <climits> #include <cmath> #include <queue> #include <stack> #include <set> #include <utility> #include <vector> #include <bitset> #include <deque> #include <iomanip> #include <complex> #include <fstream> #include <sstream> //#include <map> //#include <list> using namespace std; #if ( _WIN32 || __WIN32__ ) #define LLD "%I64d" #else #define LLD "%lld" #endif #define show(x) cerr<<((#x))<<" = "<<((x))<<" "<<endl #define bit(a,b) (((a)>>(b))&1) #define gcd __gcd #define endl '\n' #define bcnt(x) ((__builtin_popcount(x))) #define sz(x) ((int((x).size()))) #define sqr(x) ((((x))*((x)))) template<class T> inline void smn(T &a,const T &b){if(b<a) a=b;} template<class T> inline void smx(T &a,const T &b){if(b>a) a=b;} template<class T> inline T rev(const T & a){T _=a; reverse(_.begin(),_.end()); return _;} typedef long long ll; typedef long double ld; typedef pair<int,int> pie; const double eps=1e-9; const ld leps=1e-14; int d[2050][2050]; int n,t,k; int fll(int a,int b) { if (a==0) return 0; if (d[a][b]!=-1) return d[a][b]; vector <int> res; for (int i=1;i<=min(a,b);i++) res.push_back(fll(a-i,min(i,a-i))); sort(res.begin(),res.end()); int now=0; for (int i=0;i<=res.size();i++,now++) if (i==res.size() || res[i]!=now) return d[a][b]=now; } int main(int argc,char * argv[]) { ios_base::sync_with_stdio(false); cin>>t; // for (int i=0;i<10;i++) // for (int j=1;j<=i;j++) // cerr<<"fll : "<<i<<","<<j<<" "<<fll(i,j)<<endl; while (t-->0) { int now=0; cin>>n>>k; for (int i=0;i<n;i++) { int a; cin>>a; now^=fll(a,min(a,k)); } if (now==0) cout<<"Zeta"<<endl; else cout<<"Nancy"<<endl; } return 0; }
Comments

