fork download
  1. /******************************************
  2. * AUTHOR : RAJAGOPALAN *
  3. * NICK : ARNO *
  4. * INSTITUTION : VIT *
  5. ******************************************/
  6. #include <bits/stdc++.h>
  7. #define ll long long
  8. #define ull unsigned long long
  9. #define pb push_back
  10. #define mp make_pair
  11. #define all(x) (x).begin(),(x).end()
  12. #define alli(a, n, k) (a+k),(a+n+k)
  13. #define REP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)
  14. #define REPI(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)
  15. #define REPITER(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)
  16.  
  17. #define eps 1e-6
  18. #define pi 3.141592653589793
  19. using namespace std;
  20. template<class T> inline T gcd(T x, T y) { if (!y) return x; return gcd(y, x%y);}
  21. typedef vector<int> VII;
  22. typedef vector<ll> VLL;
  23. typedef pair<int, int> PII;
  24. typedef vector< pair<int, int> > VPII;
  25. typedef vector< pair<int, PII > > VPPI;
  26. const int MOD = 1e9 + 7;
  27. const int INF = 1e9;
  28. string new_num(string nums,int i)
  29. {
  30. nums[i]=(((nums[i]-'0')+1)%10+'0');
  31. return nums;
  32. }
  33. bool traverse(string ori,string s,int n)
  34. {
  35. bool ans=false;
  36. if(n==0 && s>ori)
  37. return true;
  38. if(n==0)
  39. return false;
  40.  
  41. for(int i=0;i<4;++i)
  42. ans|=traverse(ori,new_num(s,i),n-1);
  43.  
  44. return ans;
  45. }
  46. int main(int argc, char* argv[])
  47. {
  48. ios::sync_with_stdio(false);
  49. cin.tie(NULL);
  50. int t;
  51. cin>>t;
  52. while(t--)
  53. {
  54. string s;
  55. int n;
  56. cin>>s>>n;
  57. if(n==0)
  58. cout<<"Vinit"<<endl;
  59. else{
  60. string poss[4];
  61. string flat=s;
  62. for(int j=0;j<n;++j)
  63. {
  64. vector<string>ps;
  65. for(int i=0;i<4;++i)
  66. {
  67. ps.pb(new_num(flat,i));
  68. }
  69. sort(ps.begin(),ps.end());
  70. if(j%2==0)
  71. flat=ps[3];
  72. else
  73. flat=ps[0];
  74. }
  75. if(flat>s)
  76. cout<<"Ada"<<endl;
  77. else
  78. cout<<"Vinit"<<endl;
  79. }
  80. }
  81. return 0;
  82. }
Success #stdin #stdout 0s 4496KB
stdin
Standard input is empty
stdout
Standard output is empty