結果

問題 No.1285 ゴミ捨て
ユーザー firiexpfiriexp
提出日時 2020-11-13 21:30:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,201 bytes
コンパイル時間 1,119 ms
コンパイル使用メモリ 113,136 KB
実行使用メモリ 17,664 KB
最終ジャッジ日時 2024-05-06 14:27:28
合計ジャッジ時間 3,373 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 173 ms
17,024 KB
testcase_08 AC 6 ms
5,376 KB
testcase_09 AC 63 ms
9,216 KB
testcase_10 AC 143 ms
15,376 KB
testcase_11 AC 122 ms
14,336 KB
testcase_12 AC 84 ms
11,428 KB
testcase_13 AC 89 ms
11,648 KB
testcase_14 AC 173 ms
16,384 KB
testcase_15 AC 100 ms
12,672 KB
testcase_16 AC 24 ms
6,016 KB
testcase_17 AC 25 ms
6,144 KB
testcase_18 AC 23 ms
6,016 KB
testcase_19 AC 53 ms
8,832 KB
testcase_20 AC 21 ms
5,632 KB
testcase_21 AC 31 ms
6,912 KB
testcase_22 AC 174 ms
17,664 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int n;
    cin >> n;
    map<int, int> cnt;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        cnt[x]++;
        v[i] = x;
    }
    int ans = 0;
    for (auto &&i : v) {
        int val = 0;
        for (int j = 0; j < 3; ++j) {
            val += cnt[i+j];
        }
        ans = max(ans, val);
    }
    cout << ans << "\n";
    return 0;
}
0