시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 702 546 501 81.068%

문제

이교수님은 UCPC의 교수이다. 그의 강좌는 선다형 방식으로 이루어지는 기말고사로 유명하다. 시험에는 총 10문제가 출제되며 학생들은 5개의 보기 중 가장 답에 가까운 것을 선택해야한다. 이것이 UCPC의 학생들이 그의 강좌를 좋아하는 이유이다. 하지만, 보통 문제들이 까다로워서 학생들이 시험에서 만점을 받는 것은 거의 어렵다. 

이번 학기에는 놀라운 일이 일어났다; 그의 한 강좌에서, 시험 문제들의 정답이 특별한 패턴을 형성하는 것이다! j번째 문제의 정답은 ((j-1) mod 5) +1 번이며, 여기서 mod는 나머지 연산을 의미한다. 예를 들어 첫번째 문제의 정답은 ((1-1) mod 5) +1 = 1로 1번이며, 여덟번째 문제의 정답은 ((8-1) mod 5) +1 = 3 으로 3번이 된다. 문제의 번호는 1번부터 10번이며 문제의 다섯가지 보기는 1번부터 5번까지임을 유의해라.

하지만 UCPC의 학생들의 실력은 이 패턴을 시험 시간동안 깨달았을 정도로 우수하다. 상대적으로 쉬운 앞부분의 몇 문제를 푼 후, 많은 수의 학생들이 위의 공식을 발견했고 나머지 어려운 문제들을 실제로 풀지 않고 답할 수 있었다. 이것은 명확한 부정행위이기 때문에, 이 교수님은 만점을 받은 학생들을 대상으로 새로운 시험문제로 재시험을 보기로 결정했다. (물론, 새로운 시험 문제의 답들은 아무런 패턴도 형성하지 않는다.)

N명의 학생들의 답안지가 주어졌을 때, 재시험을 보아야하는 학생의 목록을 구하는 프로그램을 작성해라.

입력

첫번째 줄은 시험을 본 학생수를 나타내는 정수 N이 주어진다.(1 ≤ N ≤ 100)

N번째 줄까지는 1에서 5사이에 해당하는 정수 열개가 주어진다. i번째 줄의 j번째 수는 i번째 학생이 고른 j번째 문제의 답을 의미한다. (1 ≤ i ≤ N, 1 ≤ j ≤ 10)

한줄에 입력되는 수들은 공백으로 구분된다.

출력

재시험을 보아야하는 학생의 목록을 오름차순으로 출력한다.

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xuIiwiaW5wdXQiOiI8cD5UaGUgZmlyc3QgbGluZSBjb250YWlucyBvbmUgaW50ZWdlciBOICgxICZsZTsgTiAmbGU7IDEwMCksIHdoaWNoIGRlbm90ZXMgdGhlIG51bWJlciBvZiBzdHVkZW50cyB3aG8gdG9vayB0aGUgZXhhbS4gRWFjaCBvZiB0aGUgZm9sbG93aW5nIE4gbGluZXMgY29udGFpbiB0ZW4gaW50ZWdlcnMgYmV0d2VlbiAxIGFuZCA1OyB0aGUgai10aCBudW1iZXIgaW4gdGhlIGktdGggbGluZSBkZW5vdGVzIHRoZSBjaG9pY2UgbWFkZSBieSB0aGUgaS10aCBzdHVkZW50IGZvciB0aGUgai10aCBleGFtIHByb2JsZW0gKDEgJmxlOyBpICZsZTsgTiwgMSAmbGU7IGogJmxlOyAxMCkuIFRoZSBudW1iZXJzIGluIHRoZSBzYW1lIGxpbmUgb2YgdGhlIGlucHV0IGFyZSBzZXBhcmF0ZWQgYnkgYSBzaW5nbGUgc3BhY2UuPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+UHJpbnQgdGhlIG51bWJlciBvZiB0aGUgc3R1ZGVudHMgd2hvIHNob3VsZCByZXRha2UgdGhlIGV4YW0sIHNvcnRlZCBpbiBhc2NlbmRpbmcgb3JkZXIuIEVhY2ggc3R1ZGVudCBudW1iZXIgbXVzdCBiZSBvbiBhIHNlcGFyYXRlIGxpbmUuPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

Contest > 전국 대학생 프로그래밍 대회 동아리 연합 여름 대회 > UCPC 2015 A번