포럼
문제 ICPC00192

E. Equality Control

설명

In programming contest circles, one of the most important roles is that of the Chief Equality Officer (CEO). This person is responsible for making sure that every team has an equal chance of winning the contest. Since last year's NWERC the current CEO, Gregor, has thought at length about how to make the contest even more fair and equal.

His answer is to introduce a new programming language as the only one allowed for submissions. This way, no team will be disadvantaged by not having mastered any of the allowed languages. This language is called Balloon, short for Building A Long List Of Ordinary Numbers. Its only data type is the list of integers. To keep the language fast, it contains only four instructions:
- [x\(_1\),...,x\(_n\)] is the constructor for lists. It returns the integers inside the brackets in their given order.
- concat(<Expr\(_1\)>,<Expr\(_2\)>) returns a list of all the integers returned when evaluating the expression <Expr\(_1\)> followed by all of the integers returned when evaluating <Expr\(_2\)>.
- shuffle() returns a list of all the integers returned by , rearranged according to a uniformly random permutation, i.e., each permutation of the elements is used with equal probability.
- sorted() returns a list of all the integers returned by , rearranged into non-decreasing order.

As an example, consider the first expression of Sample Input 1. The two shuffle exressions both take the list [1,2] as input and return one of the lists [1,2] and [2,1], each with probability \(0.5\) (independently of each other). The outer concat operator takes the two returned lists as its input and returns their concatenation. I.e., it returns one of the lists [1,2,1,2], [1,2,2,1], [2,1,1,2], and [2,1,2,1], each with probability \(0.25\).

Naturally, we cannot use byte-by-byte output comparison any more when teams submit their solutions in Balloon, as its output is probabilistic. The judge server instead has to check whether a submitted program is equivalent to the sample solution created by the judges. Two programs are equivalent if for any list \(L\) of integers, both programs have an equal probability of returning \(L\).

It is your task to determine whether two given Balloon programs are equivalent.

제약
입력 형식

The input consists of:
- One line containing a string A, the first program.
- One line containing a string B, the second program.

Each program is a syntactically valid Balloon program with between \(3\) and \(10^6\) characters, and contains neither spacing nor empty lists (i.e., the strings " " or "[]" do not occur in the input).

Each integer in each program is greater than \(0\) and less than \(10^{9}\).

출력 형식

If the two programs are equivalent, output "equal", otherwise output "not equal".

예제 1
입력
concat(shuffle([1,2]),shuffle([1,2]))
shuffle([1,2,1,2])
출력
not equal
예제 2
입력
sorted(concat([3,2,1],[4,5,6]))
[1,2,3,4,5,6]
출력
equal
예제 3
입력
concat(sorted([4,3,2,1]),shuffle([1]))
concat(concat([1,2,3],shuffle([4])),sorted([1]))
출력
equal
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NWERC 2018

평가 및 의견

E. Equality Control

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

E. Equality Control

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8