QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100

#23885. สมาชิกร่วม

Statistics

โจทย์ปัญหา

กำหนดลำดับจำนวนเต็ม $A = (A_{1}, A_{2}, \dots, A_{N})$ ที่มีความยาว $N$ และลำดับจำนวนเต็ม $B = (B_{1}, B_{2}, \dots, B_{M})$ ที่มีความยาว $M$ จงแสดงผลจำนวนเต็มทั้งหมดที่ปรากฏในทั้ง $A$ และ $B$ จำนวนละ $1$ ตัว เรียงจากน้อยไปมาก

ข้อจำกัด

  • $1 \le N \le 100$.
  • $1 \le M \le 100$.
  • $1 \le A_{i} \le 100$ ($1 \le i \le N$).
  • $1 \le B_{j} \le 100$ ($1 \le j \le M$).

ข้อมูลนำเข้า

ข้อมูลนำเข้าจะได้รับจากข้อมูลนำเข้ามาตรฐานในรูปแบบต่อไปนี้:

N M
A_1 A_2 ... A_N
B_1 B_2 ... B_M

ข้อมูลส่งออก

แสดงผลจำนวนเต็มทั้งหมดที่ปรากฏในทั้ง $A$ และ $B$ จำนวนละ $1$ ตัว เรียงจากน้อยไปมาก โดยคั่นแต่ละจำนวนด้วยการขึ้นบรรทัดใหม่

ตัวอย่างข้อมูลนำเข้าและส่งออก

ข้อมูลนำเข้าตัวอย่าง 1

6 5
2 4 6 8 10 12
15 12 9 6 3

ข้อมูลส่งออกตัวอย่าง 1

6
12
  • $6$ ปรากฏในตำแหน่งที่ $3$ ของ $A$ และตำแหน่งที่ $4$ ของ $B$ นอกจากนี้ $12$ ปรากฏในตำแหน่งที่ $6$ ของ $A$ และตำแหน่งที่ $2$ ของ $B$ นอกจาก $6$ และ $12$ แล้ว ไม่มีจำนวนเต็มอื่นที่ปรากฏในทั้ง $A, B$ ดังนั้นจึงแสดงผล $6, 12$ เรียงจากน้อยไปมากโดยคั่นด้วยการขึ้นบรรทัดใหม่

ข้อมูลนำเข้าตัวอย่าง 2

3 5
100 100 100
100 100 100 100 100

ข้อมูลส่งออกตัวอย่าง 2

100
  • $100$ ปรากฏในทั้ง $A, B$ นอกจาก $100$ แล้ว ไม่มีจำนวนเต็มอื่นที่ปรากฏใน $A, B$ ดังนั้นจึงแสดงผล $100$

ข้อมูลนำเข้าตัวอย่าง 3

1 1
2
5

ข้อมูลส่งออกตัวอย่าง 3

```

- ไม่มีจำนวนเต็มที่ปรากฏในทั้ง $A, B$ ดังนั้นจึงไม่ต้องแสดงผลใดๆ

---

#### ข้อมูลนำเข้าตัวอย่าง 4

10 10 76 91 98 7 98 7 98 10 63 91 70 71 10 10 91 70 65 10 63 76

#### ข้อมูลส่งออกตัวอย่าง 4

10 63 76 91 ```

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.