| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1323849 | jmuzhen | Homework (CEOI22_homework) | Pypy 3 | 485 ms | 170968 KiB |
s = input()
# find indexes of occurrences of min and max respectively in O(n)
idx_min = []
idx_max = []
for i in range(len(s)):
if s.startswith("min", i):
idx_min.append(i)
elif s.startswith("max", i):
idx_max.append(i)
mn = len(idx_min)
mx = len(idx_max)
n = s.count("?")
# now merge
merged = []
for i in idx_min:
merged.append((i, 'min'))
for i in idx_max:
merged.append((i, 'max'))
merged.sort()
bal = 0
lb = 1
ub = n
for (_, t) in merged:
if t == 'min':
bal -= 1
if bal < 0:
ub -= 1
else:
bal += 1
if bal > 0:
lb += 1
ans = max(0, ub - lb + 1)
print(ans)컴파일 시 표준 출력 (stdout) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
