結果
| 問題 | No.2757 Pin Game |
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-05-18 06:24:28 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 459 bytes |
| 記録 | |
| コンパイル時間 | 1,112 ms |
| コンパイル使用メモリ | 217,352 KB |
| 実行使用メモリ | 9,976 KB |
| 最終ジャッジ日時 | 2026-07-04 18:39:53 |
| 合計ジャッジ時間 | 2,000 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/segtree>
using namespace std;
int N,K,X[3<<17];
int op(int a, int b){return max(a,b);}
int e(){return 0;}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N>>K;
for(int i=0;i<N;i++)cin>>X[i];
atcoder::segtree<int,op,e>seg(N);
int r=0;
for(int i=0;i<N;i++)
{
while(r<i&&X[r]+K<=X[i])r++;
seg.set(i,seg.prod(0,r)+1);
}
cout<<seg.all_prod()<<endl;
}
nonon