結果

問題 No.1268 Fruit Rush 2
ユーザー finefine
提出日時 2020-10-23 22:53:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 661 bytes
コンパイル時間 1,589 ms
コンパイル使用メモリ 168,912 KB
実行使用メモリ 9,076 KB
最終ジャッジ日時 2023-09-28 17:24:10
合計ジャッジ時間 7,019 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 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 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 31 ms
4,412 KB
testcase_17 AC 26 ms
4,384 KB
testcase_18 AC 28 ms
4,380 KB
testcase_19 AC 27 ms
4,380 KB
testcase_20 AC 27 ms
4,380 KB
testcase_21 AC 26 ms
4,376 KB
testcase_22 AC 31 ms
4,408 KB
testcase_23 AC 31 ms
4,424 KB
testcase_24 AC 28 ms
4,380 KB
testcase_25 AC 26 ms
4,376 KB
testcase_26 AC 43 ms
4,580 KB
testcase_27 AC 44 ms
4,636 KB
testcase_28 AC 43 ms
4,584 KB
testcase_29 AC 43 ms
4,572 KB
testcase_30 AC 43 ms
4,580 KB
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

constexpr char newl = '\n';

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    ll ans = n;
    for (int i = 1; i < n; i++) {
        if (a[i] - a[i - 1] != 1) continue;
        ll cur = a[i];
        ++ans;
        for (int j = i + 1; j < n; j++) {
            if (a[j] > cur + 2) break;
            if (a[j] < cur + 2) continue;
            cur += 2;
            ++ans;
        }
    }
    cout << ans << newl;

    return 0;
}
0