結果
| 問題 |
No.1827 最長部分スーパーリッチ門松列列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-30 17:59:51 |
| 言語 | Scala(Beta) (3.6.2) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 699 bytes |
| コンパイル時間 | 15,455 ms |
| コンパイル使用メモリ | 259,296 KB |
| 実行使用メモリ | 131,176 KB |
| 最終ジャッジ日時 | 2024-06-11 08:21:37 |
| 合計ジャッジ時間 | 60,734 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 TLE * 2 |
ソースコード
import scala.collection.mutable
import scala.io.StdIn.*
import scala.math.*
@main def main =
val testCase = readLine().toInt
for _ <- 0 until testCase do
val n = readLine().toInt
val permutation = readLine().split(' ').map(_.toInt)
val isUpper = Array.fill(n){true}
var count = 1
var result = 0
for i <- permutation.indices.sortBy(permutation) do
if i > 0 then
if isUpper(i - 1) == isUpper(i) then
count += 1
else
count -= 1
if i + 1 < n then
if isUpper(i) == isUpper(i + 1) then
count += 1
else
count -= 1
isUpper(i) = false
result = max(result, count)
println(result)