結果

問題 No.1827 最長部分スーパーリッチ門松列列
ユーザー mai
提出日時 2021-09-20 13:43:30
言語 cLay
(20241019-1)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 3,122 ms
コンパイル使用メモリ 173,352 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-07-21 22:08:44
合計ジャッジ時間 4,408 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

int imos[500001];

void solve() {
  int N, last_a;
  rd(N);

  fill(imos, imos+N, 0);
  last_a = -1;
  REP(i, N) {
    int a; rd(a);
    if (last_a >= 0) {
      imos[min(a, last_a)] += 1;
      imos[max(a, last_a)] -= 1;
    }
    last_a = a;
  }

  int best = 0, sum = 0;
  REP(i, N)
    best >?= (sum += imos[i]);

  wt(best + 1);
}
{
  int T; rd(T); REP(_, T) solve();
}
0