// Ahmadov orz
/// successful failure
#include <bits/stdc++.h>
/// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
/// using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define pii pair<int, int>
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define drop(x) cout<<x<<endl;return
// template <class T>
// using isTree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/// sometimes you gotta think simple
struct custom_hash {
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
x ^= FIXED_RANDOM;
return x ^ (x >> 16);
}
};
const int N = 1e6 + 7;
bool vis[N];
void failure()
{
int n;
cin >> n;
vector <int> arr(n);
//map <int,int> mp;
for (int i = 0; i < n; i++) {
cin >> arr[i];
//mp[arr[i]]++;
}
int ans = 0;
int curr = 0;
for (int i = 0; i < n; i++) {
if (curr < arr[i]) {
ans++;
curr = arr[i] - 1;
}
else {
curr--;
}
}
drop(ans);
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int tt = 1;
//cin >> tt;
while (tt--)
{
failure();
}
}
# |
결과 |
실행 시간 |
메모리 |
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 |
336 KB |
Output isn't correct |
5 |
Incorrect |
40 ms |
10228 KB |
Output isn't correct |
6 |
Incorrect |
39 ms |
10844 KB |
Output isn't correct |
7 |
Incorrect |
32 ms |
9040 KB |
Output isn't correct |
8 |
Incorrect |
32 ms |
8784 KB |
Output isn't correct |
9 |
Incorrect |
48 ms |
9544 KB |
Output isn't correct |
10 |
Incorrect |
42 ms |
9808 KB |
Output isn't correct |