結果

問題 No.1268 Fruit Rush 2
ユーザー shinchanshinchan
提出日時 2020-10-23 23:59:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 2,277 ms
コンパイル使用メモリ 212,836 KB
実行使用メモリ 42,176 KB
最終ジャッジ日時 2023-09-28 19:18:46
合計ジャッジ時間 7,406 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 136 ms
16,488 KB
testcase_17 AC 120 ms
15,956 KB
testcase_18 AC 127 ms
16,324 KB
testcase_19 AC 124 ms
16,268 KB
testcase_20 AC 122 ms
16,180 KB
testcase_21 AC 121 ms
16,160 KB
testcase_22 AC 138 ms
16,632 KB
testcase_23 AC 137 ms
16,548 KB
testcase_24 AC 125 ms
16,152 KB
testcase_25 AC 121 ms
16,416 KB
testcase_26 AC 238 ms
42,040 KB
testcase_27 AC 240 ms
42,112 KB
testcase_28 AC 239 ms
42,136 KB
testcase_29 AC 236 ms
42,048 KB
testcase_30 AC 237 ms
42,176 KB
testcase_31 AC 174 ms
16,972 KB
testcase_32 AC 173 ms
16,948 KB
testcase_33 AC 179 ms
17,072 KB
testcase_34 AC 211 ms
29,644 KB
testcase_35 AC 227 ms
29,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
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 n;
    cin >> n;
    vector<ll> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    sort(be(a));
    ll ans = 0;
    map<ll, ll> mp;
    for(int i=0;i<n;i++){
    	mp[a[i]]++;
    	mp[a[i] + 1] += mp[a[i] - 1]; 
    }
    for(auto& i: mp) ans += i.second;
    cout << ans << endl;
    return 0;
}
0