fork(1) download
  1. #pragma comment(linker,"/STACK:100000000000,100000000000")
  2.  
  3. #include <iostream>
  4. #include <cstdio>
  5. #include <cstdlib>
  6. #include <algorithm>
  7. #include <string>
  8. #include <cstring>
  9. #include <vector>
  10. #include <cmath>
  11. #include <map>
  12. #include <stack>
  13. #include <set>
  14. #include <iomanip>
  15. #include <queue>
  16. #include <map>
  17. #include <functional>
  18. #include <memory.h>
  19. #include <list>
  20. #include <sstream>
  21. #include <ctime>
  22. #include <climits>
  23. #include <bitset>
  24. #include <list>
  25. #include <cassert>
  26. #include <complex>
  27.  
  28. using namespace std;
  29.  
  30. /* Constants begin */
  31. const long long inf = 1e18+7;
  32. const long long mod = 1e9+7;
  33. const double eps = 1e-12;
  34. const double PI = 2*acos(0.0);
  35. const double E = 2.71828;
  36. /* Constants end */
  37.  
  38. /* Defines begin */
  39. #define pb push_back
  40. #define mp make_pair
  41. #define ll long long
  42. #define double long double
  43. #define F first
  44. #define S second
  45. #define all(a) (a).begin(),(a).end()
  46. #define forn(i,n) for (int (i)=0;(i)<(ll)(n);(i)++)
  47. #define random (rand()<<16|rand())
  48. #define sqr(x) (x)*(x)
  49. #define base complex<double>
  50. /* Defines end */
  51.  
  52. inline void Solve(){
  53. int n, m, x, ans = 0; scanf("%d%d",&n,&m);
  54. forn(i,n){
  55. forn(j,m){
  56. scanf("%d",&x);
  57. if((i+j) % 2 != (n + m - 2) % 2) ans ^= x;
  58. }
  59. }
  60. puts(ans ? "win" : "lose");
  61. }
  62.  
  63. int main(void) {
  64. #ifndef ONLINE_JUDGE
  65. freopen("input.txt","rt",stdin);
  66. freopen("output.txt","wt",stdout);
  67. #endif
  68. int T; scanf("%d",&T);
  69. forn(i,T){
  70. printf("Case %d: ",(int)i+1);
  71. Solve();
  72. }
  73. return 0;
  74. }
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
Case 1: lose