Logo
(追記) (追記ここまで)

32316번 - Ready for Contest 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB90705681.159%

문제

Whenever the UCF Programming Team Coaches prepare for the UCF Local Programming Contest, each problem requires valid judge solutions in C++ and Java. Python solutions may be written as well, but these are optional. Thus, the coaches consider a problem to be ready for the contest if it has at least one C++ solution and at least one Java solution.

Unfortunately, instead of writing solutions for the problems that need them, the coaches just pick their favorite problems and write solutions for those instead. Naturally, they use their favorite language as well instead of checking to see what solutions hasn't been written yet.

Although many solutions have been written, it may be the case that some problems aren't ready for the contest yet. Write a program to determine which problems are ready to go!

Given the number of problems that have been proposed, and a list of every solution written (which problem and which language), determine the problems that are contest ready (have both a C++ and a Java solution written).

입력

The first input line contains two integers: n (1 ≤ n ≤ 105), indicating the number of problems proposed and m (2 ≤ m ≤ 3×105), indicating the number of solutions written. The problems are numbered 1 through n.

The information about each solution written are provided in the following m input lines, with each line specifying a single solution written. Each of these input lines contains two integers: p (1 ≤ p ≤ n), and L (1 ≤ L ≤ 3), indicating that a solution has been written for problem number p in language L. If L = 1, the language is C++; if L = 2, the language is Java; if L = 3, the language is Python.

출력

Print a list of the problems that are ready for contest, sorted in numerical order, with one number outputted per line. It is guaranteed that at least one problem will be ready for contest so there will be some output.

제한

예제 입력 1

3 11
1 1
1 1
3 1
3 1
3 1
2 2
1 2
2 1
3 1
2 3
2 2

예제 출력 1

1
2

예제 입력 2

4 5
1 3
1 2
3 2
3 1
4 3

예제 출력 2

3

예제 입력 3

3 9
3 3
1 3
2 2
3 2
3 1
2 1
2 3
1 2
1 1

예제 출력 3

1
2
3

힌트

출처

University > University of Central Florida > 2024 Local Programming Contest (Final Round) 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /