結果
| 問題 |
No.2924 <===Super Spaceship String===>
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 15:44:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 887 bytes |
| コンパイル時間 | 140 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 77,636 KB |
| 最終ジャッジ日時 | 2024-10-12 15:44:41 |
| 合計ジャッジ時間 | 1,639 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 6 |
ソースコード
import sys
import math
from itertools import product, permutations, combinations, accumulate
from heapq import heapify, heappush, heappop
from collections import deque, defaultdict, Counter
from bisect import bisect, bisect_left, bisect_right
from copy import copy, deepcopy
#from sortedcontainers import SortedSet, SortedList, SortedDict
sys.setrecursionlimit(10**7)
INF = float('inf')
LINF = 1 << 60
MOD = 10**9+7
def mii():
return map(int, sys.stdin.readline().split())
S = input()
N = len(S)
st = deque()
cut = 0
now = 0
for i in range(N):
c = S[i]
if c == "<":
st.append(i)
elif c == ">":
if len(st) == 0:
continue
if (i - cut) - st[-1] >= 2:
cut += (i - now) - st[-1] + 1
now += (i - now) - st[-1] + 1
st.pop()
else:
st.clear()
now = 0
print(N - cut)