結果
問題 |
No.2757 Pin Game
|
ユーザー |
![]() |
提出日時 | 2024-07-04 15:21:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 125 ms / 2,000 ms |
コード長 | 379 bytes |
コンパイル時間 | 1,503 ms |
コンパイル使用メモリ | 169,180 KB |
実行使用メモリ | 6,620 KB |
最終ジャッジ日時 | 2024-07-04 15:21:58 |
合計ジャッジ時間 | 2,524 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { int N, K; cin >> N >> K; vector<int> x(N); rep(i, N) cin >> x[i]; vector<int> ans; rep(i, N) { if(i == 0) ans.push_back(x[i]); else { if(ans.back() + K > x[i]) continue; else ans.push_back(x[i]); } } cout << ans.size() << endl; }