結果
| 問題 |
No.2281 K → K-1 01 Flip
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 21:21:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 745 bytes |
| コンパイル時間 | 310 ms |
| コンパイル使用メモリ | 82,208 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2025-06-12 21:22:33 |
| 合計ジャッジ時間 | 6,556 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 1 -- * 55 |
ソースコード
import sys
def main():
input = sys.stdin.read().split()
ptr = 0
N, Q = int(input[ptr]), int(input[ptr+1])
ptr += 2
S = input[ptr]
ptr += 1
for _ in range(Q):
L = int(input[ptr]) - 1
R = int(input[ptr+1]) - 1
K = int(input[ptr+2])
ptr += 3
X = S[L:R+1]
runs = []
current = X[0]
count = 1
for c in X[1:]:
if c == current:
count += 1
else:
runs.append(count)
current = c
count = 1
runs.append(count)
if any(r >= K for r in runs):
print(2)
else:
print(len(runs))
return
if __name__ == '__main__':
main()
gew1fw