結果

問題 No.1268 Fruit Rush 2
ユーザー butsurizukibutsurizuki
提出日時 2020-10-24 00:22:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 1,775 ms
コンパイル使用メモリ 177,676 KB
実行使用メモリ 69,632 KB
最終ジャッジ日時 2023-09-28 19:33:07
合計ジャッジ時間 8,142 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 323 ms
33,672 KB
testcase_17 AC 258 ms
29,188 KB
testcase_18 AC 282 ms
30,972 KB
testcase_19 AC 276 ms
30,912 KB
testcase_20 AC 271 ms
30,256 KB
testcase_21 AC 260 ms
29,736 KB
testcase_22 AC 326 ms
34,028 KB
testcase_23 AC 326 ms
33,928 KB
testcase_24 AC 273 ms
30,580 KB
testcase_25 AC 262 ms
29,664 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 565 ms
49,328 KB
testcase_32 AC 568 ms
49,392 KB
testcase_33 WA -
testcase_34 AC 412 ms
69,632 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

map<long long,long long> mp;
map<long long,long long> fl;
map<long long,long long> ex;

long long f(long long x){
  if(ex[x]==0){return 0;}
  if(fl[x]==1){return mp[x];}
  fl[x]=1;
  mp[x]=1+f(x+2);
  return mp[x];
}

int main(){
  int n;
  cin >> n;
  vector<int> vc(n);
  for(int i=0;i<n;i++){cin >> vc[i];ex[vc[i]]=1;}
  sort(vc.begin(),vc.end());
  long long res=n;
  for(int i=0;i<n;i++){
    res+=f(vc[i]+1);
  }
  cout << res << '\n';
}
0