結果

問題 No.1268 Fruit Rush 2
ユーザー okok
提出日時 2020-10-23 23:37:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 690 ms / 2,000 ms
コード長 987 bytes
コンパイル時間 1,056 ms
コンパイル使用メモリ 99,252 KB
実行使用メモリ 68,892 KB
最終ジャッジ日時 2023-09-28 18:53:30
合計ジャッジ時間 12,158 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 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,384 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 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 1 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 390 ms
30,356 KB
testcase_17 AC 335 ms
29,592 KB
testcase_18 AC 361 ms
30,096 KB
testcase_19 AC 351 ms
28,880 KB
testcase_20 AC 350 ms
28,876 KB
testcase_21 AC 346 ms
29,644 KB
testcase_22 AC 394 ms
29,676 KB
testcase_23 AC 393 ms
29,764 KB
testcase_24 AC 358 ms
29,236 KB
testcase_25 AC 357 ms
29,324 KB
testcase_26 AC 678 ms
68,760 KB
testcase_27 AC 690 ms
68,552 KB
testcase_28 AC 666 ms
68,604 KB
testcase_29 AC 650 ms
68,668 KB
testcase_30 AC 660 ms
68,892 KB
testcase_31 AC 506 ms
31,188 KB
testcase_32 AC 502 ms
31,284 KB
testcase_33 AC 302 ms
31,620 KB
testcase_34 AC 399 ms
56,188 KB
testcase_35 AC 418 ms
56,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
    vector<int> A;
    map<int,int> mp, mp2;
    int con = 0;
    
    cin>>N;
	
    // A.resize(N);
    
	for(int i = 0; i < N; i++){
        int a;
        cin>>a;
        
        mp[a] = 1;
        mp2[a] = 1;
        
        A.push_back(a);
        A.push_back(a+1);
    }
    
    sort(A.begin(), A.end());
    A.erase(unique(A.begin(), A.end()), A.end());
    
    for(int i = 0; i < A.size(); i++){
        if(mp2[A[i]-1]) mp[A[i]] += mp[A[i]-2];
        
        con += mp[A[i]];
    }
    
    cout<<con<<endl;
    
	return 0;
}
0