제출 #1139279

#제출 시각아이디문제언어결과실행 시간메모리
1139279THXuanBaloni (COCI15_baloni)C++20
100 / 100
168 ms3972 KiB
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <set> #include <map> #define INF 1e9 typedef long long ll; using namespace std; void solve() { int n; cin >> n; vector<int>v(n); for (int i = 0; i < n; i++)cin >> v[i]; int ans = 0; map<int, int>visited; for (int i = 0; i < n; i++) { if (!visited[v[i] + 1])++ans; else visited[v[i] + 1]--; visited[v[i]]++; } cout << ans << "\n"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1;// cin >> t; while (t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...