Submission #19149439


Source Code Expand

N = int(input())
S = [input() for _ in range(N)]
S.sort()


def end():
    print('satisfiable')
    exit()


def search(mid):
    return S[mid][0] != '!'
ok = N
ng = -1
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if search(mid):
        ok = mid
    else:
        ng = mid
if 1 <= ok < N - 1:
    outS = S[ok:]
    exS = S[:ok]

    exS = [x[1:] for x in exS]
else:
    end()

bpoint = 0
for i in range(len(outS)):

    while len(exS) > bpoint and outS[i] > exS[bpoint]:
        bpoint += 1
    if bpoint >= len(exS):
        end()
    if outS[i] == exS[bpoint]:

        print(outS[i])
        exit()
end()

Submission Info

Submission Time
Task C - 1-SAT
User noyan
Language PyPy3 (7.3.0)
Score 300
Code Size 657 Byte
Status AC
Exec Time 361 ms
Memory 104104 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 30
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All 01_small.txt, 02_small.txt, 03_small.txt, 04_small.txt, 05_small.txt, 06_small.txt, 07_small.txt, 08_small.txt, 09_small.txt, 10_small.txt, 11_small.txt, 12_small.txt, 13_small.txt, 14_small.txt, 15_small.txt, 16_satisfiable1.txt, 17_satisfiable2.txt, 18_unsatisfiable1.txt, 19_unsatisfiable1.txt, 20_unsatisfiable1.txt, 21_unsatisfiable1.txt, 22_unsatisfiable1.txt, 23_unsatisfiable1.txt, 24_unsatisfiable1.txt, 25_unsatisfiable1.txt, 26_unsatisfiable2.txt, 27_unsatisfiable2.txt, 28_same.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
01_small.txt AC 86 ms 62048 KiB
02_small.txt AC 52 ms 61992 KiB
03_small.txt AC 52 ms 61712 KiB
04_small.txt AC 53 ms 61908 KiB
05_small.txt AC 49 ms 61880 KiB
06_small.txt AC 52 ms 61940 KiB
07_small.txt AC 54 ms 61884 KiB
08_small.txt AC 53 ms 62044 KiB
09_small.txt AC 53 ms 61784 KiB
10_small.txt AC 53 ms 61872 KiB
11_small.txt AC 53 ms 61980 KiB
12_small.txt AC 53 ms 61912 KiB
13_small.txt AC 52 ms 62020 KiB
14_small.txt AC 54 ms 62028 KiB
15_small.txt AC 51 ms 61876 KiB
16_satisfiable1.txt AC 361 ms 103968 KiB
17_satisfiable2.txt AC 344 ms 104044 KiB
18_unsatisfiable1.txt AC 350 ms 103612 KiB
19_unsatisfiable1.txt AC 348 ms 104104 KiB
20_unsatisfiable1.txt AC 342 ms 104064 KiB
21_unsatisfiable1.txt AC 343 ms 104084 KiB
22_unsatisfiable1.txt AC 330 ms 100324 KiB
23_unsatisfiable1.txt AC 333 ms 100328 KiB
24_unsatisfiable1.txt AC 339 ms 104068 KiB
25_unsatisfiable1.txt AC 328 ms 100168 KiB
26_unsatisfiable2.txt AC 334 ms 100432 KiB
27_unsatisfiable2.txt AC 337 ms 100476 KiB
28_same.txt AC 237 ms 91288 KiB
sample_01.txt AC 52 ms 61756 KiB
sample_02.txt AC 54 ms 61980 KiB