#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds
int main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,m,q;cin>>n>>m>>q;
int ans = 0;
int ans2=0;
int arr[n];
for(int i=0;i<n;i++) cin>>arr[i];
for(int i=0;i<n-1;i++){
ans2+=max(arr[i],arr[i+1]);
}
int k = unique(arr,arr+n)-arr;
for(int i=0;i<k-2;i++) if(arr[i]==2 && arr[i+1]==1 && arr[i+2]==2) ans2--;
for(int i=0;i<m;i++){
int u,v;cin>>u>>v;
}
cout<<ans2<<"\n";
return 0;
}
Compilation message
guard.cpp: In function 'int main()':
guard.cpp:13:6: warning: unused variable 'ans' [-Wunused-variable]
13 | int ans = 0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
31 ms |
4032 KB |
Output is correct |
3 |
Correct |
33 ms |
4032 KB |
Output is correct |
4 |
Correct |
33 ms |
3924 KB |
Output is correct |
5 |
Correct |
31 ms |
3900 KB |
Output is correct |
6 |
Correct |
31 ms |
3928 KB |
Output is correct |
7 |
Correct |
32 ms |
3920 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
31 ms |
4032 KB |
Output is correct |
3 |
Correct |
33 ms |
4032 KB |
Output is correct |
4 |
Correct |
33 ms |
3924 KB |
Output is correct |
5 |
Correct |
31 ms |
3900 KB |
Output is correct |
6 |
Correct |
31 ms |
3928 KB |
Output is correct |
7 |
Correct |
32 ms |
3920 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
31 ms |
4032 KB |
Output is correct |
3 |
Correct |
33 ms |
4032 KB |
Output is correct |
4 |
Correct |
33 ms |
3924 KB |
Output is correct |
5 |
Correct |
31 ms |
3900 KB |
Output is correct |
6 |
Correct |
31 ms |
3928 KB |
Output is correct |
7 |
Correct |
32 ms |
3920 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
31 ms |
4032 KB |
Output is correct |
3 |
Correct |
33 ms |
4032 KB |
Output is correct |
4 |
Correct |
33 ms |
3924 KB |
Output is correct |
5 |
Correct |
31 ms |
3900 KB |
Output is correct |
6 |
Correct |
31 ms |
3928 KB |
Output is correct |
7 |
Correct |
32 ms |
3920 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
31 ms |
4032 KB |
Output is correct |
3 |
Correct |
33 ms |
4032 KB |
Output is correct |
4 |
Correct |
33 ms |
3924 KB |
Output is correct |
5 |
Correct |
31 ms |
3900 KB |
Output is correct |
6 |
Correct |
31 ms |
3928 KB |
Output is correct |
7 |
Correct |
32 ms |
3920 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |