wa~哭笑天使
1 #include <stdio.h> 2 #define M 301 3 int r[M], c[M]; 4 5 int main() 6 { 7 int k, m, n, i, j, sum, flag, t; 8 scanf("%d", &k); 9 while(k--){ 10 11 sum = 0; 12 scanf("%d %d", &m, &n); 13 for(i = 1; i <= m; i++){ 14 15 scanf("%d", &r[i]); 16 if(r[i]) 17 { 18 sum++; 19 } 20 21 } 22 for(i = 1; i <= n; i++){ 23 24 scanf("%d", &c[i]); 25 26 } 27 flag = 0; 28 for(i = 1; i <= n; i++){ 29 30 t = 0; 31 if(sum == 0 && c[i] != 0 || sum < c[i] && c[i] == m) 32 { 33 flag = 1; 34 break; 35 } 36 else if(sum == c[i]) 37 { 38 for(i = 1; i <= m; i++){ 39 40 if(r[i] == n) 41 t++; 42 43 } 44 if(t != c[i]) 45 { 46 flag = 1; 47 break; 48 } 49 } 50 else if(sum > c[i]) 51 { 52 for(j = 1; j <= m; j++){ 53 54 if(r[j] == n) 55 { 56 t++; 57 } 58 } 59 if(t > c[i]) 60 { 61 flag = 1; 62 break; 63 } 64 } 65 } 66 if(flag == 1) 67 printf("Terrible\n"); 68 else 69 printf("Not sure\n"); 70 71 } 72 return 0; 73 }