結果
| 問題 | No.1285 ゴミ捨て |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-13 21:35:14 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 515 bytes |
| 記録 | |
| コンパイル時間 | 1,040 ms |
| コンパイル使用メモリ | 107,560 KB |
| 実行使用メモリ | 13,568 KB |
| 最終ジャッジ日時 | 2026-05-22 20:12:15 |
| 合計ジャッジ時間 | 2,094 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
vector<long long> A(N);
for(int i = 0; i < N; i++) cin >> A[i];
sort(A.begin(), A.end());
map<int, int> m;
for(int i = 0; i < N; i++) m[A[i]]++;
int ans = 0;
for(int i = 0; i < N; i++){
ans = max(ans, m[A[i]] + m[A[i] - 1]);
}
cout << ans << endl;
}