結果

問題 No.1268 Fruit Rush 2
ユーザー shinchanshinchan
提出日時 2020-10-23 23:04:12
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 380 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 214,688 KB
実行使用メモリ 51,892 KB
最終ジャッジ日時 2023-09-28 17:43:25
合計ジャッジ時間 9,767 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 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 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 221 ms
24,192 KB
testcase_17 AC 190 ms
22,616 KB
testcase_18 AC 195 ms
23,172 KB
testcase_19 AC 193 ms
23,144 KB
testcase_20 AC 192 ms
22,936 KB
testcase_21 AC 191 ms
22,668 KB
testcase_22 AC 223 ms
24,292 KB
testcase_23 AC 224 ms
24,112 KB
testcase_24 AC 209 ms
23,012 KB
testcase_25 AC 191 ms
22,752 KB
testcase_26 AC 380 ms
51,812 KB
testcase_27 AC 368 ms
51,860 KB
testcase_28 AC 371 ms
51,816 KB
testcase_29 AC 370 ms
51,892 KB
testcase_30 AC 372 ms
51,812 KB
testcase_31 AC 301 ms
26,816 KB
testcase_32 AC 314 ms
26,808 KB
testcase_33 AC 240 ms
26,812 KB
testcase_34 AC 271 ms
39,372 KB
testcase_35 AC 290 ms
39,320 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;
    ll a[n];
    set<ll> s;
    for(int i=0;i<n;i++){
    	cin >> a[i];
    	s.insert(a[i]);
    }
    sort(a, a+n);
    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