#include <bits/stdc++.h>
#define int long long
using namespace std;
int b[1000000];
signed main()
{
int n;
cin >> n;
int a[n];
for(int i=0; i < n; i++)cin>>a[i];
for(int i=0; i < n;i++){
for(int j=i+1; j < n; j++){
if(a[i]-1==a[j])b[i]++;
}
}
int rez=0;
for(int i=0; i < n; i++){
//cout<<b[i]<< " ";
}
// cout<<endl;
for(int i=0; i < n; i++){
if(a[i]==1 || b[i]==0)rez++;
}
cout<<rez;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
6 ms |
492 KB |
Output isn't correct |
4 |
Incorrect |
9 ms |
344 KB |
Output isn't correct |
5 |
Execution timed out |
2079 ms |
10180 KB |
Time limit exceeded |
6 |
Execution timed out |
2033 ms |
11168 KB |
Time limit exceeded |
7 |
Execution timed out |
2015 ms |
9248 KB |
Time limit exceeded |
8 |
Execution timed out |
2035 ms |
9136 KB |
Time limit exceeded |
9 |
Execution timed out |
2041 ms |
9856 KB |
Time limit exceeded |
10 |
Execution timed out |
2067 ms |
10028 KB |
Time limit exceeded |