結果
| 問題 |
No.1285 ゴミ捨て
|
| コンテスト | |
| ユーザー |
data9824
|
| 提出日時 | 2020-11-15 04:00:50 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 50 ms / 2,000 ms |
| コード長 | 366 bytes |
| コンパイル時間 | 552 ms |
| コンパイル使用メモリ | 65,564 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-28 21:52:01 |
| 合計ジャッジ時間 | 1,908 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
sort(a.begin(), a.end());
int result = 1;
for (int i = 1; i < n; ++i) {
int diff = a[i] - a[i - 1];
if (diff == 1) {
result = 2;
}
}
cout << result << endl;
return 0;
}
data9824