結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 626 ms
37,948 KB
testcase_17 AC 555 ms
37,700 KB
testcase_18 AC 609 ms
37,620 KB
testcase_19 AC 597 ms
37,580 KB
testcase_20 AC 585 ms
37,756 KB
testcase_21 AC 570 ms
37,580 KB
testcase_22 AC 630 ms
37,792 KB
testcase_23 AC 639 ms
37,888 KB
testcase_24 AC 627 ms
37,696 KB
testcase_25 AC 562 ms
37,696 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 807 ms
38,056 KB
testcase_32 AC 809 ms
38,056 KB
testcase_33 WA -
testcase_34 AC 651 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);
    st.insert(vc[i]+2);
    st.insert(vc[i]+3);
    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