結果

問題 No.1268 Fruit Rush 2
ユーザー butsurizukibutsurizuki
提出日時 2020-10-24 00:30:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 473 bytes
コンパイル時間 1,880 ms
コンパイル使用メモリ 180,160 KB
実行使用メモリ 72,420 KB
最終ジャッジ日時 2023-09-28 19:40:16
合計ジャッジ時間 11,552 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 580 ms
36,512 KB
testcase_17 AC 492 ms
34,952 KB
testcase_18 AC 512 ms
35,508 KB
testcase_19 AC 517 ms
35,464 KB
testcase_20 AC 518 ms
35,196 KB
testcase_21 AC 504 ms
34,880 KB
testcase_22 AC 577 ms
36,644 KB
testcase_23 AC 581 ms
36,568 KB
testcase_24 AC 520 ms
35,468 KB
testcase_25 AC 498 ms
35,140 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 732 ms
38,104 KB
testcase_32 AC 734 ms
38,216 KB
testcase_33 WA -
testcase_34 AC 567 ms
72,420 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;


int main(){
  int n;
  cin >> n;
  vector<int> vc(n);
  set<int> st;
  map<long long,long long> dp;
  map<long long,long long> ex;
  for(int i=0;i<n;i++){
    cin >> vc[i];
    st.insert(vc[i]);
    st.insert(vc[i]+1);
    dp[vc[i]]=1;
    ex[vc[i]]=1;
  }
  sort(vc.begin(),vc.end());
  long long res=0;
  for(auto k:st){
    if(k>=3){
      if(ex[k-1]==1){dp[k]+=dp[k-2];}
    }
    res+=dp[k];
  }
  cout << res << '\n';
}
0