RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0533

Reverse Engineering

Bronze II 브론즈 II
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Elsie has a program that takes as input an array of \(N\) (\(1\le N\le 100\))
variables \(b[0],\dots,b[N-1]\), each equal to zero or one, and returns the
result of applying a sequence of if / else if / else statements on the input.
Each statement examines the value of at most one input variable, and returns
either zero or one. An example of such a program might be:

if (b[1] == 1) return 1;
else if (b[0] == 0) return 0;
else return 1;

For example, if the input to the program above is "10" (that is, \(b[0] = 1\) and
\(b[1] = 0\)), then the output should be 1.

Elsie has told Bessie the correct output for \(M\) (\(1\le M\le 100\)) different
inputs. Bessie is now trying to reverse engineer Elsie's program. Unfortunately,
Elsie might have lied; it may be the case that no program of the form above is
consistent with what Elsie said.

For each of \(T\) (\(1\le T\le 10\)) test cases, determine whether Elsie must be
lying or not.

Problem credits: Benjamin Qi

제약

SCORING

  • Inputs 2 and 3 have \(N = 2\).
  • Inputs 4 and 5 have \(M = 2\).
  • Inputs 6 through 12 have no additional constraints.

Problem credits: Benjamin Qi

입력 형식

The first line contains \(T\), the number of test cases.

Each test case starts with two integers \(N\) and \(M\), followed by \(M\) lines, each
containing a string of \(N\) zeros and ones representing an input (that is, the
values of \(b[0] \ldots b[N-1]\)) and an additional character (zero or one)
representing the output. Consecutive test cases are separated by newlines.

출력 형식

For each test case, output "OK" or "LIE" on a separate line.

예제 1
입력
4

1 3
0 0
0 0
1 1

2 4
00 0
01 1
10 1
11 1

1 2
0 1
0 0

2 4
00 0
01 1
10 1
11 0
출력
OK
OK
LIE
LIE
설명

Here's a valid program for the first test case:

if (b[0] == 0) return 0;
else return 1;

Another valid program for the first test case:

if (b[0] == 1) return 1;
else return 0;

A valid program for the second test case:

if (b[1] == 1) return 1;
else if (b[0] == 0) return 0;
else return 1;

Clearly, there is no valid program corresponding to the third test case, because
Elsie's program must always produce the same output for the same input.

It may be shown that there is no valid program corresponding to the last test
case.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2022-2023 > December > Bronze

태그

평가 및 의견

Reverse Engineering

개요
출제자 난이도 Bronze II 브론즈 II 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Reverse Engineering

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