結果

問題 No.1268 Fruit Rush 2
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-12-23 01:19:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 483 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 2,326 ms
コンパイル使用メモリ 214,724 KB
実行使用メモリ 50,304 KB
最終ジャッジ日時 2023-12-23 01:19:27
合計ジャッジ時間 11,337 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 1 ms
6,548 KB
testcase_03 AC 4 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 1 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 2 ms
6,548 KB
testcase_12 AC 2 ms
6,548 KB
testcase_13 AC 2 ms
6,548 KB
testcase_14 AC 2 ms
6,548 KB
testcase_15 AC 2 ms
6,548 KB
testcase_16 AC 276 ms
22,912 KB
testcase_17 AC 248 ms
21,632 KB
testcase_18 AC 255 ms
22,144 KB
testcase_19 AC 282 ms
22,016 KB
testcase_20 AC 240 ms
21,888 KB
testcase_21 AC 230 ms
21,760 KB
testcase_22 AC 274 ms
23,040 KB
testcase_23 AC 299 ms
23,040 KB
testcase_24 AC 245 ms
22,016 KB
testcase_25 AC 234 ms
21,760 KB
testcase_26 AC 444 ms
50,304 KB
testcase_27 AC 475 ms
50,304 KB
testcase_28 AC 446 ms
50,304 KB
testcase_29 AC 483 ms
50,304 KB
testcase_30 AC 445 ms
50,304 KB
testcase_31 AC 376 ms
25,344 KB
testcase_32 AC 403 ms
25,344 KB
testcase_33 AC 217 ms
25,344 KB
testcase_34 AC 229 ms
37,888 KB
testcase_35 AC 246 ms
37,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0