#include<bits/stdc++.h>
using namespace std;
#define iii tuple<int,int,int>
int n;
int cnt = 0;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n;
int recent;
cnt = n;
for(int i=1;i<=n;++i)
{
int x,y;
cin >> x >> y;
if(i == 1) continue;
if(y == 1 && recent == 0) --cnt;
if(y == 0 && recent == 1) --cnt;
recent = y;
}
cout << cnt;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1448 ms |
2668 KB |
Output is correct |
2 |
Correct |
1391 ms |
1128 KB |
Output is correct |
3 |
Correct |
1305 ms |
1460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1356 ms |
1872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1448 ms |
2668 KB |
Output is correct |
2 |
Correct |
1391 ms |
1128 KB |
Output is correct |
3 |
Correct |
1305 ms |
1460 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |