asa

0309 2021-06-09 18:58:02

#include<cstdio>
#include<cstdlib>
	int n, m, a[311], b[311], ans;
int main(){
	int c = 0, x, y;
	scanf("%d%d", &n, &m);
	x = n > m ? (m > c ? c : m) : (n > c ? c : n);
	printf("%d\n", x);
	y = int (n > m ? n : m);
	printf("%d\n", y);
	
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	for(int j = 1; j <= m; j++)
		scanf("%d", &b[j]);
	for(int i = 1; i <= n; i++){
	
		for(int j = i + 1; j <= n; j++){
		
		ans = a[i] + a[j];
		for(int k = 1; k <= m; k++){
			
		
		for(int l = k + 1; l <= m; l++){
		
		for(int h = l + 1; h <= m; h++){
		
			if(ans == b[k] + b[l] + b[h]){
			printf("%d %d\n", a[i], a[j]);	
			}
			}}}}}
	exit(0);
}