結果

問題 No.1285 ゴミ捨て
ユーザー firiexpfiriexp
提出日時 2020-11-13 21:30:47
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,201 bytes
コンパイル時間 1,147 ms
コンパイル使用メモリ 110,740 KB
実行使用メモリ 17,676 KB
最終ジャッジ日時 2023-08-19 07:13:56
合計ジャッジ時間 4,006 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 193 ms
16,776 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 69 ms
9,156 KB
testcase_10 AC 177 ms
15,164 KB
testcase_11 AC 153 ms
14,116 KB
testcase_12 AC 99 ms
11,376 KB
testcase_13 AC 91 ms
11,224 KB
testcase_14 AC 174 ms
16,300 KB
testcase_15 AC 115 ms
12,604 KB
testcase_16 AC 25 ms
5,972 KB
testcase_17 AC 26 ms
6,004 KB
testcase_18 AC 24 ms
5,776 KB
testcase_19 AC 57 ms
8,732 KB
testcase_20 AC 21 ms
5,580 KB
testcase_21 AC 33 ms
6,660 KB
testcase_22 AC 205 ms
17,676 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