Water of water

#include "cstdio"
#include "algorithm"
#include "iostream"
using namespace std;
int a[50010][60];
int b[10001],c[101];
int main(){
    int n , m , t;
    int f,sum;
    scanf ("%d%d%d",&n,&m,&t);
           sum=0;
           for (int i = 1 ; i <= n; i++){
                  for (int j = 1; j <= m ; j++){
                         scanf ("%d",&a[i][j]);
                  }
           }
           for (int i = 1  ;i <= t; i++)scanf ("%d%d",&b[i],&c[i]);//b[i] 第几题  c[i]  题目的答案 
           
                  for (int j = 1 ; j <= n ; j++){
                                       f=0;
                           for (int i = 1 ; i <= t; i++){
                                  if (a[j][b[i]]==c[i]){      //如果对不上 
                                            f++; 
                                  }
                          }
                          if (f==t){
                                  sum=sum+1;
                          }
                  }    
            printf ("%d\n",sum);
}

Cattle off the above subject, I submitted a total of nine times, eight times in front of super memory, I wonder that strange, do question of time before such a mistake can not. no idea! I think this question should simply simulate fishes, then suddenly found that I looks like a large array of open, look closely, the question is intended to open a n * m array, n <50000, m <50. I opened before n * n. = =, Or too dishes.

Guess you like

Origin www.cnblogs.com/AChappy/p/11964494.html