EIFBIPARTIE - Complete Bipartite
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Given the complete bipartite graph with the number of vertices in two distinct subsets are ~n~ and ~m~. Output the list of edges in the lexicographic order
Input
- The first line contains two integers ~n, m~ ~(0 < n, m ≤ 10^3)~.
- The second line contains ~n~ distinct integers ~a_i~ ~(0 ≤ a_i ≤ 10^9)~ that represent vertices of the first subset
- The second line contains ~m~ distinct integers ~b_j~ ~(0 ≤ b_j ≤ 10^9)~ that represent vertices of the second subset.
- ~50\%~ of test cases has ~(0 ≤ a_i ≤ n-1, n ≤ b_j ≤ n+m-1)~.
- ~90\%~ of test cases has ~(0 ≤ a_i, b_j ≤ n+m-1)~.
Output
- Output the edges of the graph in lexicographic order.
Sample Input 1
3 2
0 3 1
4 2
Sample Output 1
0 2
0 4
1 2
1 4
2 3
3 4
Sample Input 2
3 2
0 1 2
3 4
Sample Output 2
0 3
0 4
1 3
1 4
2 3
2 4
Bình luận