結果
問題 | No.1686 Geschenkt |
ユーザー |
|
提出日時 | 2021-09-24 21:37:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 959 ms |
コンパイル使用メモリ | 100,764 KB |
最終ジャッジ日時 | 2025-01-24 16:55:39 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <utility> #include <set> #include <queue> #include <cmath> using namespace std; typedef long long ll; #define rep(i, n) for (int i=0;i < (int)(n);i++) int main(){ int n; cin >> n; set<int> st; vector<int> a(n); rep(i,n){ int x; cin >> x; a[i] = x; st.insert(x); } int ans = 0; for (auto x:a){ if (st.count(x-1) != 1){ ans += x; } } cout << ans << endl; return 0; }