link/cut tree
[kudsource.git] / POJ / 3213.c
blob9cde5d84b2720ebd1d7d4116b5634e1f53a2a653
1 #include <stdio.h>
2 #include <stdbool.h>
4 #define maxn 1010
5 #define rep(i,n) for(i=0; i<n; ++i)
7 int n,p,m,a[maxn][maxn],b[maxn][maxn];
9 int mul(int i, int j) {
10 int k,res=0;
11 rep(k,p) res+=(a[i][k]*b[k][j]);
12 return res;
15 int main() {
16 scanf("%d%d%d",&n,&p,&m);
17 int i,j;
18 rep(i,n)
19 rep(j,p)
20 scanf("%d",&a[i][j]);
21 rep(i,p)
22 rep(j,m)
23 scanf("%d",&b[i][j]);
24 bool flag=false;
25 int p,q,k,ans=0;
26 rep(i,n) {
27 rep(j,m) {
28 scanf("%d",&k);
29 if (!flag && (ans=mul(i,j)) != k) {
30 flag=true;
31 p=i,q=j;
35 if (flag) {
36 puts("No");
37 printf("%d %d\n%d\n",++p,++q,ans);
38 } else puts("Yes");
39 return 0;