結果
問題 |
No.1268 Fruit Rush 2
|
ユーザー |
|
提出日時 | 2020-10-24 00:06:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 687 bytes |
コンパイル時間 | 1,753 ms |
コンパイル使用メモリ | 176,216 KB |
実行使用メモリ | 23,024 KB |
最終ジャッジ日時 | 2024-07-21 14:04:33 |
合計ジャッジ時間 | 6,283 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 12 |
ソースコード
#include<bits/stdc++.h> using namespace std; long long mem[524288]; long long f(long long x){ if(x==0){return 0;} if(mem[x]!=-1){return mem[x];} mem[x]=1+(x/2)+f(x-1); return mem[x]; } int main(){ for(int i=0;i<524288;i++){mem[i]=-1;} set<long long> st; int n; cin >> n; for(int i=0;i<n;i++){ long long v; cin >> v; st.insert(v); } vector<long long> vc; for(auto x: st){ vc.push_back(x); } vc.push_back(-1); long long c=1,res=0; for(int i=0;i<n;i++){ //printf("%lld %lld\n",vc[i],vc[i+1]); if(vc[i]+1!=vc[i+1]){ //printf("%lld\n",c); res+=f(c); c=1; } else{c++;} } cout << res << '\n'; return 0; }