#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define nmod(a, b) (((a%b)+b)%b) // stands for [n]atural [mod], as in "will always return a natural number", should be used in case of negative
#define a2b(a, b) (a << b) // a*2^b
#define bit(a, b) ((a >> b) & 1) // bth bit from the right, starts at zero
using namespace std;
template<class T> using vec = vector<T>;
const int INFTY = (1LL << 63) - 1;
const int NNFTY = 1LL << 63;
int32_t main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n; cin >> n;
vec<int> h(n); for (auto &x : h) cin >> x;
int k = 1; for (int i = 0; i < n - 1; i++) if (h[i] != h[i + 1] + 1) k++;
cout << k;
}
Compilation message
baloni.cpp:10:31: warning: integer overflow in expression of type 'long long int' results in '9223372036854775807' [-Woverflow]
10 | const int INFTY = (1LL << 63) - 1;
| ~~~~~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
36 ms |
6548 KB |
Output isn't correct |
6 |
Incorrect |
40 ms |
7248 KB |
Output isn't correct |
7 |
Incorrect |
36 ms |
5968 KB |
Output isn't correct |
8 |
Incorrect |
32 ms |
5968 KB |
Output isn't correct |
9 |
Incorrect |
36 ms |
6224 KB |
Output isn't correct |
10 |
Incorrect |
39 ms |
6480 KB |
Output isn't correct |