結果
問題 | No.1285 ゴミ捨て |
ユーザー | shinchan |
提出日時 | 2020-12-27 16:12:57 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 43 ms / 2,000 ms |
コード長 | 787 bytes |
コンパイル時間 | 1,800 ms |
コンパイル使用メモリ | 205,952 KB |
実行使用メモリ | 8,376 KB |
最終ジャッジ日時 | 2023-08-19 07:28:57 |
合計ジャッジ時間 | 3,191 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,384 KB |
testcase_07 | AC | 40 ms
7,904 KB |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | AC | 15 ms
5,308 KB |
testcase_10 | AC | 33 ms
7,272 KB |
testcase_11 | AC | 30 ms
7,008 KB |
testcase_12 | AC | 22 ms
6,064 KB |
testcase_13 | AC | 21 ms
6,048 KB |
testcase_14 | AC | 36 ms
7,684 KB |
testcase_15 | AC | 26 ms
6,412 KB |
testcase_16 | AC | 7 ms
4,476 KB |
testcase_17 | AC | 7 ms
4,508 KB |
testcase_18 | AC | 7 ms
4,380 KB |
testcase_19 | AC | 14 ms
5,184 KB |
testcase_20 | AC | 7 ms
4,380 KB |
testcase_21 | AC | 10 ms
4,556 KB |
testcase_22 | AC | 43 ms
8,040 KB |
testcase_23 | AC | 42 ms
8,376 KB |
ソースコード
#include <bits/stdc++.h> #define be(v) (v).begin(),(v).end() #define pb(q) push_back(q) #define rep(i, n) for(int i=0;i<n;i++) typedef long long ll; using namespace std; const ll mod=1000000007, INF=(1LL<<60); #define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); ll ans, n; cin >> n; set<ll> s; rep(i, n){ cin >> ans; s.insert(ans); } ans = 0; while(!s.empty()){ ans++; ll now = *s.begin(); s.erase(now); auto itr = s.upper_bound(now + 1); while(itr != s.end()){ now = *itr; s.erase(itr); itr = s.upper_bound(now + 1); } } cout << ans << endl; return 0; }