daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. char line[1 << 10];
  4. int x[1 << 10][1 << 10], now[1 << 10];
  5.  
  6. int minChanges(int N)
  7. {
  8.    
  9. }
  10.  
  11. int main()
  12. {
  13.     int i, j, test, Q, N, M;
  14.    
  15.     freopen("data.in", "r", stdin);
  16.     freopen("data.out", "w", stdout);
  17.    
  18.     scanf("%d", &Q);
  19.     for (test = 1; test <= Q; test ++)
  20.     {
  21.         scanf("%d%d", &N, &M);
  22.         for (i = 1; i <= N; i ++)
  23.         {
  24.             gets(x + 1);
  25.             for (j = 1; j <= M; j ++)
  26.                 x[i][j] = line[j] - '0';
  27.         }
  28.        
  29.         memset(now, 0, sizeof(now));
  30.         for (i = 1; i <= N; i ++)
  31.             for (j = 1; j <= M; j ++)
  32.                 now[i] += x[i][j];
  33.         int sol = minChanges(N);
  34.         if (sol == -1)
  35.         {
  36.             printf("Case %d: impossible\n", test);
  37.             continue;
  38.         }
  39.         memset(now, 0, sizeof(now));
  40.         for (j = 1; j <= M; j ++)
  41.             for (i = 1; i <= N; i ++)
  42.                 now[j] += x[i][j];
  43.         int sol2 = minChanges(M);
  44.         if (sol2 == -1)
  45.         {
  46.             printf("Case %d: row %d\n", test, sol);
  47.             continue;
  48.         }
  49.         printf("Case %d: both %d\n", test, sol + sol2);
  50.     }
  51.    
  52.     return 0;
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top