結果
問題 | No.1285 ゴミ捨て |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:15:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 629 bytes |
コンパイル時間 | 2,065 ms |
コンパイル使用メモリ | 201,160 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-20 21:16:27 |
合計ジャッジ時間 | 4,338 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 WA * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int N;cin >> N;vector<int> A(N);for (int &a : A) {cin >> a;}sort(A.begin(), A.end());multiset<int> s;for (int y : A) {auto it = s.lower_bound(y);if (it == s.begin()) {s.insert(y);} else {--it;if (*it <= y - 2) {s.erase(it);s.insert(y);} else {s.insert(y);}}}cout << s.size() << endl;return 0;}