結果
| 問題 |
No.1268 Fruit Rush 2
|
| コンテスト | |
| ユーザー |
hanyu
|
| 提出日時 | 2020-05-31 15:18:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 648 bytes |
| コンパイル時間 | 1,404 ms |
| コンパイル使用メモリ | 168,548 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-22 07:43:02 |
| 合計ジャッジ時間 | 7,172 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 RE * 9 TLE * 1 -- * 4 |
ソースコード
// 愚直が撃墜されるか確認
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<ll> exist(2e5, false);
for (int i = 0; i < n; i++) {
int a;
cin >> a;
exist.at(a - 1) = true;
}
ll ans = n; // 1個だけ選ぶとき
for (int i = 1; i < 2e5; i++) {
if (exist.at(i - 1) && exist.at(i)) {
ll cnt = 1, it = i;
while (it < 2e5 - 2) {
if (exist.at(it + 2)) {
cnt++;
it += 2;
}
else break;
}
ans += cnt;
}
}
cout << ans << '\n';
}
hanyu