結果
問題 |
No.1268 Fruit Rush 2
|
ユーザー |
![]() |
提出日時 | 2023-12-23 01:19:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 445 ms / 2,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 2,245 ms |
コンパイル使用メモリ | 205,972 KB |
最終ジャッジ日時 | 2025-02-18 13:28:21 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll N, A, ans=0; cin >> N; set<ll> st; map<ll, ll> mp; for (int i=0; i<N; i++){ cin >> A; st.insert(A); mp[A]++; } for (auto x : st){ mp[x+1] += mp[x-1]; } for (auto [x, y] : mp){ ans += y; } cout << ans << endl; return 0; }