結果
| 問題 |
No.1285 ゴミ捨て
|
| コンテスト | |
| ユーザー |
kya_ski
|
| 提出日時 | 2020-10-15 19:28:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 72 ms / 2,000 ms |
| コード長 | 459 bytes |
| コンパイル時間 | 517 ms |
| コンパイル使用メモリ | 71,928 KB |
| 実行使用メモリ | 8,192 KB |
| 最終ジャッジ日時 | 2024-11-28 21:32:10 |
| 合計ジャッジ時間 | 1,986 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <set>
int main() {
size_t n;
std::cin >> n;
std::set<int> st;
for (size_t i = 0; i < n; i++) {
int a;
std::cin >> a;
st.insert(a);
}
int ans = 0;
while (not st.empty()) {
int cur = *st.begin();
st.erase(st.begin());
ans++;
while (not st.empty()) {
auto next = st.upper_bound(cur + 1);
if (next == st.end()) break;
cur = *next;
st.erase(next);
}
}
std::cout << ans << '\n';
return 0;
}
kya_ski