# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
931886 | 2024-02-22T14:08:06 Z | hugsfromadicto | Baloni (COCI15_baloni) | C++14 | 184 ms | 8968 KB |
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define int long long using namespace std; const int mxN = 1e6 + 1; int a[mxN], b[mxN]; void _() { int n; cin >> n; for(int i = 0;i < n; ++i) cin >> a[i]; map<int,int>r; int cnt = 0; for(int i = 0; i < n; ++i) { if(r[a[i] + 1] == 0) { cnt++; } else { r[a[i] + 1]--; } r[a[i]]++; } cout << cnt; } main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tc = 1; while(tc--) { _(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 184 ms | 8900 KB | Output is correct |
6 | Correct | 173 ms | 8968 KB | Output is correct |
7 | Correct | 135 ms | 8716 KB | Output is correct |
8 | Correct | 134 ms | 8532 KB | Output is correct |
9 | Correct | 152 ms | 8532 KB | Output is correct |
10 | Correct | 154 ms | 8532 KB | Output is correct |