#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,a;
cin>>n>>m;
vector<int>v(n);
int cnt=0;
for(int i=0;i<m;i++)
{
cin>>a;
if(a>0)
{
v[a]=max(cnt+1,v[a]+1);
if(v[a]==cnt+2)
{
cnt++;
}
}
else
{
v[a]=cnt;
}
}
cout<<cnt;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
564 KB |
Output is correct |
3 |
Correct |
1 ms |
504 KB |
Output is correct |
4 |
Runtime error |
21 ms |
848 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
17 ms |
704 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
45 ms |
2220 KB |
Output is correct |
6 |
Correct |
1 ms |
1104 KB |
Output is correct |
7 |
Correct |
21 ms |
800 KB |
Output is correct |
8 |
Correct |
18 ms |
816 KB |
Output is correct |
9 |
Correct |
18 ms |
804 KB |
Output is correct |
10 |
Correct |
28 ms |
796 KB |
Output is correct |
11 |
Correct |
26 ms |
1104 KB |
Output is correct |
12 |
Correct |
29 ms |
1372 KB |
Output is correct |
13 |
Correct |
35 ms |
1724 KB |
Output is correct |
14 |
Correct |
38 ms |
2384 KB |
Output is correct |
15 |
Correct |
40 ms |
2376 KB |
Output is correct |
16 |
Correct |
43 ms |
2228 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
37 ms |
2376 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
41 ms |
2228 KB |
Output is correct |
22 |
Correct |
1 ms |
500 KB |
Output is correct |
23 |
Correct |
1 ms |
1104 KB |
Output is correct |
24 |
Correct |
1 ms |
508 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Runtime error |
1 ms |
592 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
564 KB |
Output is correct |
3 |
Correct |
1 ms |
504 KB |
Output is correct |
4 |
Runtime error |
21 ms |
848 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |