# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1042262 |
2024-08-02T18:21:58 Z |
Abito |
Baloni (COCI15_baloni) |
C++17 |
|
33 ms |
12368 KB |
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
const int N=1e6+5;
int a[N],n,f[N];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
for (int i=1;i<=n;i++) cin>>a[i];
int ans=n;
for (int i=n;i;i--){
if (f[a[i]-1]) ans--,f[a[i]-1]--;
f[a[i]]++;
}cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2524 KB |
Output is correct |
5 |
Correct |
31 ms |
12248 KB |
Output is correct |
6 |
Correct |
33 ms |
12368 KB |
Output is correct |
7 |
Correct |
26 ms |
11364 KB |
Output is correct |
8 |
Correct |
27 ms |
11364 KB |
Output is correct |
9 |
Correct |
30 ms |
11880 KB |
Output is correct |
10 |
Correct |
28 ms |
11612 KB |
Output is correct |