【CF1016D】Vasya And The Matrix(构造)
题意:
思路:构造方式见代码……
1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 typedef long long ll; 6 using namespace std; 7 #define N 110 8 #define oo 10000000 9 #define MOD 1000000007 10 11 int a[N],b[N]; 12 13 int main() 14 { 15 int n,m; 16 scanf("%d%d",&n,&m); 17 int s1=0,s2=0; 18 for(int i=1;i<=n;i++) 19 { 20 scanf("%d",&a[i]); 21 s1^=a[i]; 22 } 23 for(int i=1;i<=m;i++) 24 { 25 scanf("%d",&b[i]); 26 s2^=b[i]; 27 } 28 if(s1!=s2) 29 { 30 printf("NO\n"); 31 return 0; 32 } 33 printf("YES\n"); 34 for(int i=1;i<=n;i++) 35 { 36 for(int j=1;j<=m;j++) 37 { 38 if(i==1&&j==1){printf("%d ",s1^a[1]^b[1]); continue;} 39 if(i==1){printf("%d ",b[j]); continue;} 40 if(j==1){printf("%d ",a[i]); continue;} 41 printf("0 "); 42 } 43 printf("\n"); 44 } 45 return 0; 46 } 47
null