CodeForces 413B 手速题

//CodeForces 413B

 1 #include "iostream"
 2 #include "cstdio"
 3 #include "cstring"
 4 #include "algorithm"
 5 #include "vector"
 6 using namespace std;
 7 int mat[20010][12], ans[200010], line[12];
 8 int n, m, k;
 9 
10 int main()
11 {
12     int i, j;
13     scanf("%d%d%d", &n, &m, &k);
14     for(i = 1; i <= n; ++i)
15         for(j = 1; j <= m; ++j)
16             scanf("%d", &mat[i][j]);
17     int a, b;
18     for(i = 1; i <= k; ++i) {
19         scanf("%d%d", &a, &b);
20         --ans[a];
21         ++line[b];
22     }
23     for(i = 1; i <= n; ++i)
24         for(j = 1; j <= m; ++j)
25             if(mat[i][j])
26                 ans[i] += line[j];
27     printf("%d", ans[1]);
28     for(i = 2; i <= n; ++i)
29         printf(" %d", ans[i]);
30     printf("\n");
31 }

 

posted @ 2015-02-24 18:17  AC_Phoenix  阅读(180)  评论(0)    收藏  举报